Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2001-2002 by David Brownell |
David Brownell | 53bd6a6 | 2006-08-30 14:50:06 -0700 | [diff] [blame] | 4 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your |
| 8 | * option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | * for more details. |
| 14 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* this file is part of ehci-hcd.c */ |
| 18 | |
Oliver Neukum | 1c20163 | 2013-11-18 13:23:16 +0100 | [diff] [blame] | 19 | #ifdef CONFIG_DYNAMIC_DEBUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 21 | /* |
| 22 | * check the values in the HCSPARAMS register |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | * (host controller _Structural_ parameters) |
| 24 | * see EHCI spec, Table 2-4 for each value |
| 25 | */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 26 | static void dbg_hcs_params(struct ehci_hcd *ehci, char *label) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | { |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 28 | u32 params = ehci_readl(ehci, &ehci->caps->hcs_params); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 30 | ehci_dbg(ehci, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | "%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n", |
| 32 | label, params, |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 33 | HCS_DEBUG_PORT(params), |
| 34 | HCS_INDICATOR(params) ? " ind" : "", |
| 35 | HCS_N_CC(params), |
| 36 | HCS_N_PCC(params), |
| 37 | HCS_PORTROUTED(params) ? "" : " ordered", |
| 38 | HCS_PPC(params) ? "" : " !ppc", |
Geyslan G. Bem | 78698d6 | 2016-01-25 22:44:57 -0300 | [diff] [blame] | 39 | HCS_N_PORTS(params)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | /* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 41 | if (HCS_PORTROUTED(params)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | int i; |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 43 | char buf[46], tmp[7], byte; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | buf[0] = 0; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 46 | for (i = 0; i < HCS_N_PORTS(params); i++) { |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 47 | /* FIXME MIPS won't readb() ... */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 48 | byte = readb(&ehci->caps->portroute[(i >> 1)]); |
David Brownell | 53bd6a6 | 2006-08-30 14:50:06 -0700 | [diff] [blame] | 49 | sprintf(tmp, "%d ", |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 50 | (i & 0x1) ? byte & 0xf : (byte >> 4) & 0xf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | strcat(buf, tmp); |
| 52 | } |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 53 | ehci_dbg(ehci, "%s portroute %s\n", label, buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } |
| 55 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 57 | /* |
| 58 | * check the values in the HCCPARAMS register |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | * (host controller _Capability_ parameters) |
| 60 | * see EHCI Spec, Table 2-5 for each value |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 61 | */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 62 | static void dbg_hcc_params(struct ehci_hcd *ehci, char *label) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | { |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 64 | u32 params = ehci_readl(ehci, &ehci->caps->hcc_params); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 66 | if (HCC_ISOC_CACHE(params)) { |
| 67 | ehci_dbg(ehci, |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 68 | "%s hcc_params %04x caching frame %s%s%s\n", |
| 69 | label, params, |
| 70 | HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024", |
| 71 | HCC_CANPARK(params) ? " park" : "", |
| 72 | HCC_64BIT_ADDR(params) ? " 64 bit addr" : ""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | } else { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 74 | ehci_dbg(ehci, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 75 | "%s hcc_params %04x thresh %d uframes %s%s%s%s%s%s%s\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 76 | label, |
| 77 | params, |
| 78 | HCC_ISOC_THRES(params), |
| 79 | HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024", |
| 80 | HCC_CANPARK(params) ? " park" : "", |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 81 | HCC_64BIT_ADDR(params) ? " 64 bit addr" : "", |
| 82 | HCC_LPM(params) ? " LPM" : "", |
| 83 | HCC_PER_PORT_CHANGE_EVENT(params) ? " ppce" : "", |
| 84 | HCC_HW_PREFETCH(params) ? " hw prefetch" : "", |
| 85 | HCC_32FRAME_PERIODIC_LIST(params) ? |
Masanari Iida | 855ef45 | 2012-02-17 23:06:47 +0900 | [diff] [blame] | 86 | " 32 periodic list" : ""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | } |
| 88 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 90 | static void __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 91 | dbg_qtd(const char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | { |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 93 | ehci_dbg(ehci, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd, |
| 94 | hc32_to_cpup(ehci, &qtd->hw_next), |
| 95 | hc32_to_cpup(ehci, &qtd->hw_alt_next), |
| 96 | hc32_to_cpup(ehci, &qtd->hw_token), |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 97 | hc32_to_cpup(ehci, &qtd->hw_buf[0])); |
| 98 | if (qtd->hw_buf[1]) |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 99 | ehci_dbg(ehci, " p1=%08x p2=%08x p3=%08x p4=%08x\n", |
| 100 | hc32_to_cpup(ehci, &qtd->hw_buf[1]), |
| 101 | hc32_to_cpup(ehci, &qtd->hw_buf[2]), |
| 102 | hc32_to_cpup(ehci, &qtd->hw_buf[3]), |
| 103 | hc32_to_cpup(ehci, &qtd->hw_buf[4])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | } |
| 105 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 106 | static void __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 107 | dbg_qh(const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | { |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 109 | struct ehci_qh_hw *hw = qh->hw; |
| 110 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 111 | ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label, |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 112 | qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current); |
| 113 | dbg_qtd("overlay", ehci, (struct ehci_qtd *) &hw->hw_qtd_next); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | } |
| 115 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 116 | static void __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 117 | dbg_itd(const char *label, struct ehci_hcd *ehci, struct ehci_itd *itd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 119 | ehci_dbg(ehci, "%s [%d] itd %p, next %08x, urb %p\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 120 | label, itd->frame, itd, hc32_to_cpu(ehci, itd->hw_next), |
| 121 | itd->urb); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 122 | ehci_dbg(ehci, |
David Brownell | 53bd6a6 | 2006-08-30 14:50:06 -0700 | [diff] [blame] | 123 | " trans: %08x %08x %08x %08x %08x %08x %08x %08x\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 124 | hc32_to_cpu(ehci, itd->hw_transaction[0]), |
| 125 | hc32_to_cpu(ehci, itd->hw_transaction[1]), |
| 126 | hc32_to_cpu(ehci, itd->hw_transaction[2]), |
| 127 | hc32_to_cpu(ehci, itd->hw_transaction[3]), |
| 128 | hc32_to_cpu(ehci, itd->hw_transaction[4]), |
| 129 | hc32_to_cpu(ehci, itd->hw_transaction[5]), |
| 130 | hc32_to_cpu(ehci, itd->hw_transaction[6]), |
| 131 | hc32_to_cpu(ehci, itd->hw_transaction[7])); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 132 | ehci_dbg(ehci, |
David Brownell | 53bd6a6 | 2006-08-30 14:50:06 -0700 | [diff] [blame] | 133 | " buf: %08x %08x %08x %08x %08x %08x %08x\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 134 | hc32_to_cpu(ehci, itd->hw_bufp[0]), |
| 135 | hc32_to_cpu(ehci, itd->hw_bufp[1]), |
| 136 | hc32_to_cpu(ehci, itd->hw_bufp[2]), |
| 137 | hc32_to_cpu(ehci, itd->hw_bufp[3]), |
| 138 | hc32_to_cpu(ehci, itd->hw_bufp[4]), |
| 139 | hc32_to_cpu(ehci, itd->hw_bufp[5]), |
| 140 | hc32_to_cpu(ehci, itd->hw_bufp[6])); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 141 | ehci_dbg(ehci, " index: %d %d %d %d %d %d %d %d\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | itd->index[0], itd->index[1], itd->index[2], |
| 143 | itd->index[3], itd->index[4], itd->index[5], |
| 144 | itd->index[6], itd->index[7]); |
| 145 | } |
| 146 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 147 | static void __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 148 | dbg_sitd(const char *label, struct ehci_hcd *ehci, struct ehci_sitd *sitd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 150 | ehci_dbg(ehci, "%s [%d] sitd %p, next %08x, urb %p\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 151 | label, sitd->frame, sitd, hc32_to_cpu(ehci, sitd->hw_next), |
| 152 | sitd->urb); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 153 | ehci_dbg(ehci, |
David Brownell | 53bd6a6 | 2006-08-30 14:50:06 -0700 | [diff] [blame] | 154 | " addr %08x sched %04x result %08x buf %08x %08x\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 155 | hc32_to_cpu(ehci, sitd->hw_fullspeed_ep), |
| 156 | hc32_to_cpu(ehci, sitd->hw_uframe), |
| 157 | hc32_to_cpu(ehci, sitd->hw_results), |
| 158 | hc32_to_cpu(ehci, sitd->hw_buf[0]), |
| 159 | hc32_to_cpu(ehci, sitd->hw_buf[1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | } |
| 161 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 162 | static int __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 163 | dbg_status_buf(char *buf, unsigned len, const char *label, u32 status) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 165 | return scnprintf(buf, len, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 166 | "%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s%s", |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 167 | label, label[0] ? " " : "", status, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 168 | (status & STS_PPCE_MASK) ? " PPCE" : "", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | (status & STS_ASS) ? " Async" : "", |
| 170 | (status & STS_PSS) ? " Periodic" : "", |
| 171 | (status & STS_RECL) ? " Recl" : "", |
| 172 | (status & STS_HALT) ? " Halt" : "", |
| 173 | (status & STS_IAA) ? " IAA" : "", |
| 174 | (status & STS_FATAL) ? " FATAL" : "", |
| 175 | (status & STS_FLR) ? " FLR" : "", |
| 176 | (status & STS_PCD) ? " PCD" : "", |
| 177 | (status & STS_ERR) ? " ERR" : "", |
Geyslan G. Bem | 78698d6 | 2016-01-25 22:44:57 -0300 | [diff] [blame] | 178 | (status & STS_INT) ? " INT" : ""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | } |
| 180 | |
David Rientjes | 8234509 | 2007-05-11 14:39:44 -0700 | [diff] [blame] | 181 | static int __maybe_unused |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 182 | dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 184 | return scnprintf(buf, len, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 185 | "%s%sintrenable %02x%s%s%s%s%s%s%s", |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 186 | label, label[0] ? " " : "", enable, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 187 | (enable & STS_PPCE_MASK) ? " PPCE" : "", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | (enable & STS_IAA) ? " IAA" : "", |
| 189 | (enable & STS_FATAL) ? " FATAL" : "", |
| 190 | (enable & STS_FLR) ? " FLR" : "", |
| 191 | (enable & STS_PCD) ? " PCD" : "", |
| 192 | (enable & STS_ERR) ? " ERR" : "", |
Geyslan G. Bem | 78698d6 | 2016-01-25 22:44:57 -0300 | [diff] [blame] | 193 | (enable & STS_INT) ? " INT" : ""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | } |
| 195 | |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 196 | static const char *const fls_strings[] = { "1024", "512", "256", "??" }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | static int |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 199 | dbg_command_buf(char *buf, unsigned len, const char *label, u32 command) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 201 | return scnprintf(buf, len, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 202 | "%s%scommand %07x %s%s%s%s%s%s=%d ithresh=%d%s%s%s%s " |
| 203 | "period=%s%s %s", |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 204 | label, label[0] ? " " : "", command, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 205 | (command & CMD_HIRD) ? " HIRD" : "", |
| 206 | (command & CMD_PPCEE) ? " PPCEE" : "", |
| 207 | (command & CMD_FSP) ? " FSP" : "", |
| 208 | (command & CMD_ASPE) ? " ASPE" : "", |
| 209 | (command & CMD_PSPE) ? " PSPE" : "", |
| 210 | (command & CMD_PARK) ? " park" : "(park)", |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 211 | CMD_PARK_CNT(command), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | (command >> 16) & 0x3f, |
| 213 | (command & CMD_LRESET) ? " LReset" : "", |
| 214 | (command & CMD_IAAD) ? " IAAD" : "", |
| 215 | (command & CMD_ASE) ? " Async" : "", |
| 216 | (command & CMD_PSE) ? " Periodic" : "", |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 217 | fls_strings[(command >> 2) & 0x3], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | (command & CMD_RESET) ? " Reset" : "", |
Geyslan G. Bem | 78698d6 | 2016-01-25 22:44:57 -0300 | [diff] [blame] | 219 | (command & CMD_RUN) ? "RUN" : "HALT"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | static int |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 223 | dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | { |
| 225 | char *sig; |
| 226 | |
| 227 | /* signaling state */ |
| 228 | switch (status & (3 << 10)) { |
Geyslan G. Bem | 5bb95ec | 2016-01-25 22:44:56 -0300 | [diff] [blame] | 229 | case 0 << 10: |
| 230 | sig = "se0"; |
| 231 | break; |
| 232 | case 1 << 10: /* low speed */ |
| 233 | sig = "k"; |
| 234 | break; |
| 235 | case 2 << 10: |
| 236 | sig = "j"; |
| 237 | break; |
| 238 | default: |
| 239 | sig = "?"; |
| 240 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 243 | return scnprintf(buf, len, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 244 | "%s%sport:%d status %06x %d %s%s%s%s%s%s " |
| 245 | "sig=%s%s%s%s%s%s%s%s%s%s%s", |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 246 | label, label[0] ? " " : "", port, status, |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 247 | status >> 25, /*device address */ |
| 248 | (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ACK ? |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 249 | " ACK" : "", |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 250 | (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_NYET ? |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 251 | " NYET" : "", |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 252 | (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_STALL ? |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 253 | " STALL" : "", |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 254 | (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ERR ? |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 255 | " ERR" : "", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | (status & PORT_POWER) ? " POWER" : "", |
| 257 | (status & PORT_OWNER) ? " OWNER" : "", |
| 258 | sig, |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 259 | (status & PORT_LPM) ? " LPM" : "", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | (status & PORT_RESET) ? " RESET" : "", |
| 261 | (status & PORT_SUSPEND) ? " SUSPEND" : "", |
| 262 | (status & PORT_RESUME) ? " RESUME" : "", |
| 263 | (status & PORT_OCC) ? " OCC" : "", |
| 264 | (status & PORT_OC) ? " OC" : "", |
| 265 | (status & PORT_PEC) ? " PEC" : "", |
| 266 | (status & PORT_PE) ? " PE" : "", |
| 267 | (status & PORT_CSC) ? " CSC" : "", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 268 | (status & PORT_CONNECT) ? " CONNECT" : ""); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | } |
| 270 | |
Geyslan G. Bem | 1f8e5af | 2016-01-25 22:45:02 -0300 | [diff] [blame] | 271 | static inline void |
| 272 | dbg_status(struct ehci_hcd *ehci, const char *label, u32 status) |
| 273 | { |
| 274 | char buf[80]; |
| 275 | |
| 276 | dbg_status_buf(buf, sizeof(buf), label, status); |
| 277 | ehci_dbg(ehci, "%s\n", buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Geyslan G. Bem | 1f8e5af | 2016-01-25 22:45:02 -0300 | [diff] [blame] | 280 | static inline void |
| 281 | dbg_cmd(struct ehci_hcd *ehci, const char *label, u32 command) |
| 282 | { |
| 283 | char buf[80]; |
| 284 | |
| 285 | dbg_command_buf(buf, sizeof(buf), label, command); |
| 286 | ehci_dbg(ehci, "%s\n", buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | } |
| 288 | |
Geyslan G. Bem | 1f8e5af | 2016-01-25 22:45:02 -0300 | [diff] [blame] | 289 | static inline void |
| 290 | dbg_port(struct ehci_hcd *ehci, const char *label, int port, u32 status) |
| 291 | { |
| 292 | char buf[80]; |
| 293 | |
| 294 | dbg_port_buf(buf, sizeof(buf), label, port, status); |
| 295 | ehci_dbg(ehci, "%s\n", buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | /*-------------------------------------------------------------------------*/ |
| 299 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 300 | /* troubleshooting help: expose state in debugfs */ |
| 301 | |
| 302 | static int debug_async_open(struct inode *, struct file *); |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 303 | static int debug_bandwidth_open(struct inode *, struct file *); |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 304 | static int debug_periodic_open(struct inode *, struct file *); |
| 305 | static int debug_registers_open(struct inode *, struct file *); |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 306 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 307 | static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*); |
| 308 | static int debug_close(struct inode *, struct file *); |
| 309 | |
| 310 | static const struct file_operations debug_async_fops = { |
| 311 | .owner = THIS_MODULE, |
| 312 | .open = debug_async_open, |
| 313 | .read = debug_output, |
| 314 | .release = debug_close, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 315 | .llseek = default_llseek, |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 316 | }; |
Geyslan G. Bem | e166631 | 2016-01-25 22:45:01 -0300 | [diff] [blame] | 317 | |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 318 | static const struct file_operations debug_bandwidth_fops = { |
| 319 | .owner = THIS_MODULE, |
| 320 | .open = debug_bandwidth_open, |
| 321 | .read = debug_output, |
| 322 | .release = debug_close, |
| 323 | .llseek = default_llseek, |
| 324 | }; |
Geyslan G. Bem | e166631 | 2016-01-25 22:45:01 -0300 | [diff] [blame] | 325 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 326 | static const struct file_operations debug_periodic_fops = { |
| 327 | .owner = THIS_MODULE, |
| 328 | .open = debug_periodic_open, |
| 329 | .read = debug_output, |
| 330 | .release = debug_close, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 331 | .llseek = default_llseek, |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 332 | }; |
Geyslan G. Bem | e166631 | 2016-01-25 22:45:01 -0300 | [diff] [blame] | 333 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 334 | static const struct file_operations debug_registers_fops = { |
| 335 | .owner = THIS_MODULE, |
| 336 | .open = debug_registers_open, |
| 337 | .read = debug_output, |
| 338 | .release = debug_close, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 339 | .llseek = default_llseek, |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 340 | }; |
| 341 | |
| 342 | static struct dentry *ehci_debug_root; |
| 343 | |
| 344 | struct debug_buffer { |
| 345 | ssize_t (*fill_func)(struct debug_buffer *); /* fill method */ |
| 346 | struct usb_bus *bus; |
| 347 | struct mutex mutex; /* protect filling of buffer */ |
| 348 | size_t count; /* number of characters filled into buffer */ |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 349 | char *output_buf; |
| 350 | size_t alloc_size; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 351 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
Geyslan G. Bem | 1f8e5af | 2016-01-25 22:45:02 -0300 | [diff] [blame] | 353 | static inline char speed_char(u32 info1) |
| 354 | { |
| 355 | switch (info1 & (3 << 12)) { |
| 356 | case QH_FULL_SPEED: |
| 357 | return 'f'; |
| 358 | case QH_LOW_SPEED: |
| 359 | return 'l'; |
| 360 | case QH_HIGH_SPEED: |
| 361 | return 'h'; |
| 362 | default: |
| 363 | return '?'; |
| 364 | } |
| 365 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 367 | static inline char token_mark(struct ehci_hcd *ehci, __hc32 token) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | { |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 369 | __u32 v = hc32_to_cpu(ehci, token); |
| 370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | if (v & QTD_STS_ACTIVE) |
| 372 | return '*'; |
| 373 | if (v & QTD_STS_HALT) |
| 374 | return '-'; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 375 | if (!IS_SHORT_READ(v)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | return ' '; |
| 377 | /* tries to advance through hw_alt_next */ |
| 378 | return '/'; |
| 379 | } |
| 380 | |
Geyslan G. Bem | c768ffb | 2016-01-25 22:45:00 -0300 | [diff] [blame] | 381 | static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh, |
| 382 | char **nextp, unsigned *sizep) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | u32 scratch; |
| 385 | u32 hw_curr; |
| 386 | struct list_head *entry; |
| 387 | struct ehci_qtd *td; |
| 388 | unsigned temp; |
| 389 | unsigned size = *sizep; |
| 390 | char *next = *nextp; |
| 391 | char mark; |
Al Viro | fd05e72 | 2008-04-28 07:00:16 +0100 | [diff] [blame] | 392 | __le32 list_end = EHCI_LIST_END(ehci); |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 393 | struct ehci_qh_hw *hw = qh->hw; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 395 | if (hw->hw_qtd_next == list_end) /* NEC does this */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | mark = '@'; |
| 397 | else |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 398 | mark = token_mark(ehci, hw->hw_token); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | if (mark == '/') { /* qh_alt_next controls qh advance? */ |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 400 | if ((hw->hw_alt_next & QTD_MASK(ehci)) |
| 401 | == ehci->async->hw->hw_alt_next) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | mark = '#'; /* blocked */ |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 403 | else if (hw->hw_alt_next == list_end) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | mark = '.'; /* use hw_qtd_next */ |
| 405 | /* else alt_next points to some other qtd */ |
| 406 | } |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 407 | scratch = hc32_to_cpup(ehci, &hw->hw_info1); |
| 408 | hw_curr = (mark == '*') ? hc32_to_cpup(ehci, &hw->hw_current) : 0; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 409 | temp = scnprintf(next, size, |
Alan Stern | 8ee10d6 | 2015-11-20 13:53:45 -0500 | [diff] [blame] | 410 | "qh/%p dev%d %cs ep%d %08x %08x (%08x%c %s nak%d)" |
| 411 | " [cur %08x next %08x buf[0] %08x]", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | qh, scratch & 0x007f, |
| 413 | speed_char (scratch), |
| 414 | (scratch >> 8) & 0x000f, |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 415 | scratch, hc32_to_cpup(ehci, &hw->hw_info2), |
| 416 | hc32_to_cpup(ehci, &hw->hw_token), mark, |
| 417 | (cpu_to_hc32(ehci, QTD_TOGGLE) & hw->hw_token) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | ? "data1" : "data0", |
Alan Stern | 8ee10d6 | 2015-11-20 13:53:45 -0500 | [diff] [blame] | 419 | (hc32_to_cpup(ehci, &hw->hw_alt_next) >> 1) & 0x0f, |
| 420 | hc32_to_cpup(ehci, &hw->hw_current), |
| 421 | hc32_to_cpup(ehci, &hw->hw_qtd_next), |
| 422 | hc32_to_cpup(ehci, &hw->hw_buf[0])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | size -= temp; |
| 424 | next += temp; |
| 425 | |
| 426 | /* hc may be modifying the list as we read it ... */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 427 | list_for_each(entry, &qh->qtd_list) { |
Geyslan G. Bem | 5bb95ec | 2016-01-25 22:44:56 -0300 | [diff] [blame] | 428 | char *type; |
| 429 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 430 | td = list_entry(entry, struct ehci_qtd, qtd_list); |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 431 | scratch = hc32_to_cpup(ehci, &td->hw_token); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | mark = ' '; |
Geyslan G. Bem | 04b8ad4 | 2016-01-25 22:45:06 -0300 | [diff] [blame] | 433 | if (hw_curr == td->qtd_dma) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | mark = '*'; |
Geyslan G. Bem | 04b8ad4 | 2016-01-25 22:45:06 -0300 | [diff] [blame] | 435 | } else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | mark = '+'; |
Geyslan G. Bem | 04b8ad4 | 2016-01-25 22:45:06 -0300 | [diff] [blame] | 437 | } else if (QTD_LENGTH(scratch)) { |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 438 | if (td->hw_alt_next == ehci->async->hw->hw_alt_next) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | mark = '#'; |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 440 | else if (td->hw_alt_next != list_end) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | mark = '/'; |
| 442 | } |
Geyslan G. Bem | 5bb95ec | 2016-01-25 22:44:56 -0300 | [diff] [blame] | 443 | switch ((scratch >> 8) & 0x03) { |
| 444 | case 0: |
| 445 | type = "out"; |
| 446 | break; |
| 447 | case 1: |
| 448 | type = "in"; |
| 449 | break; |
| 450 | case 2: |
| 451 | type = "setup"; |
| 452 | break; |
| 453 | default: |
| 454 | type = "?"; |
| 455 | break; |
| 456 | } |
Geyslan G. Bem | a535597 | 2016-01-25 22:44:59 -0300 | [diff] [blame] | 457 | temp = scnprintf(next, size, |
Alan Stern | 8ee10d6 | 2015-11-20 13:53:45 -0500 | [diff] [blame] | 458 | "\n\t%p%c%s len=%d %08x urb %p" |
| 459 | " [td %08x buf[0] %08x]", |
Geyslan G. Bem | 5bb95ec | 2016-01-25 22:44:56 -0300 | [diff] [blame] | 460 | td, mark, type, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | (scratch >> 16) & 0x7fff, |
| 462 | scratch, |
Alan Stern | 8ee10d6 | 2015-11-20 13:53:45 -0500 | [diff] [blame] | 463 | td->urb, |
| 464 | (u32) td->qtd_dma, |
| 465 | hc32_to_cpup(ehci, &td->hw_buf[0])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | size -= temp; |
| 467 | next += temp; |
| 468 | if (temp == size) |
| 469 | goto done; |
| 470 | } |
| 471 | |
Geyslan G. Bem | a535597 | 2016-01-25 22:44:59 -0300 | [diff] [blame] | 472 | temp = scnprintf(next, size, "\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | size -= temp; |
| 474 | next += temp; |
| 475 | |
| 476 | done: |
| 477 | *sizep = size; |
| 478 | *nextp = next; |
| 479 | } |
| 480 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 481 | static ssize_t fill_async_buffer(struct debug_buffer *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | struct usb_hcd *hcd; |
| 484 | struct ehci_hcd *ehci; |
| 485 | unsigned long flags; |
| 486 | unsigned temp, size; |
| 487 | char *next; |
| 488 | struct ehci_qh *qh; |
| 489 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 490 | hcd = bus_to_hcd(buf->bus); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 491 | ehci = hcd_to_ehci(hcd); |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 492 | next = buf->output_buf; |
| 493 | size = buf->alloc_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 495 | *next = 0; |
| 496 | |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 497 | /* |
| 498 | * dumps a snapshot of the async schedule. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | * usually empty except for long-term bulk reads, or head. |
| 500 | * one QH per line, and TDs we know about |
| 501 | */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 502 | spin_lock_irqsave(&ehci->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | for (qh = ehci->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh) |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 504 | qh_lines(ehci, qh, &next, &size); |
Alan Stern | 6e01875 | 2013-03-22 13:31:45 -0400 | [diff] [blame] | 505 | if (!list_empty(&ehci->async_unlink) && size > 0) { |
Alan Stern | 99ac5b1 | 2012-07-11 11:21:38 -0400 | [diff] [blame] | 506 | temp = scnprintf(next, size, "\nunlink =\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | size -= temp; |
| 508 | next += temp; |
| 509 | |
Alan Stern | 6e01875 | 2013-03-22 13:31:45 -0400 | [diff] [blame] | 510 | list_for_each_entry(qh, &ehci->async_unlink, unlink_node) { |
| 511 | if (size <= 0) |
| 512 | break; |
| 513 | qh_lines(ehci, qh, &next, &size); |
| 514 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | } |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 516 | spin_unlock_irqrestore(&ehci->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 518 | return strlen(buf->output_buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 520 | |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 521 | static ssize_t fill_bandwidth_buffer(struct debug_buffer *buf) |
| 522 | { |
| 523 | struct ehci_hcd *ehci; |
Alan Stern | b35c500 | 2013-10-11 22:16:21 -0400 | [diff] [blame] | 524 | struct ehci_tt *tt; |
| 525 | struct ehci_per_sched *ps; |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 526 | unsigned temp, size; |
| 527 | char *next; |
| 528 | unsigned i; |
| 529 | u8 *bw; |
Alan Stern | b35c500 | 2013-10-11 22:16:21 -0400 | [diff] [blame] | 530 | u16 *bf; |
| 531 | u8 budget[EHCI_BANDWIDTH_SIZE]; |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 532 | |
| 533 | ehci = hcd_to_ehci(bus_to_hcd(buf->bus)); |
| 534 | next = buf->output_buf; |
| 535 | size = buf->alloc_size; |
| 536 | |
| 537 | *next = 0; |
| 538 | |
| 539 | spin_lock_irq(&ehci->lock); |
| 540 | |
| 541 | /* Dump the HS bandwidth table */ |
| 542 | temp = scnprintf(next, size, |
| 543 | "HS bandwidth allocation (us per microframe)\n"); |
| 544 | size -= temp; |
| 545 | next += temp; |
| 546 | for (i = 0; i < EHCI_BANDWIDTH_SIZE; i += 8) { |
| 547 | bw = &ehci->bandwidth[i]; |
| 548 | temp = scnprintf(next, size, |
| 549 | "%2u: %4u%4u%4u%4u%4u%4u%4u%4u\n", |
| 550 | i, bw[0], bw[1], bw[2], bw[3], |
| 551 | bw[4], bw[5], bw[6], bw[7]); |
| 552 | size -= temp; |
| 553 | next += temp; |
| 554 | } |
Alan Stern | b35c500 | 2013-10-11 22:16:21 -0400 | [diff] [blame] | 555 | |
| 556 | /* Dump all the FS/LS tables */ |
| 557 | list_for_each_entry(tt, &ehci->tt_list, tt_list) { |
| 558 | temp = scnprintf(next, size, |
| 559 | "\nTT %s port %d FS/LS bandwidth allocation (us per frame)\n", |
| 560 | dev_name(&tt->usb_tt->hub->dev), |
| 561 | tt->tt_port + !!tt->usb_tt->multi); |
| 562 | size -= temp; |
| 563 | next += temp; |
| 564 | |
| 565 | bf = tt->bandwidth; |
| 566 | temp = scnprintf(next, size, |
| 567 | " %5u%5u%5u%5u%5u%5u%5u%5u\n", |
| 568 | bf[0], bf[1], bf[2], bf[3], |
| 569 | bf[4], bf[5], bf[6], bf[7]); |
| 570 | size -= temp; |
| 571 | next += temp; |
| 572 | |
| 573 | temp = scnprintf(next, size, |
| 574 | "FS/LS budget (us per microframe)\n"); |
| 575 | size -= temp; |
| 576 | next += temp; |
| 577 | compute_tt_budget(budget, tt); |
| 578 | for (i = 0; i < EHCI_BANDWIDTH_SIZE; i += 8) { |
| 579 | bw = &budget[i]; |
| 580 | temp = scnprintf(next, size, |
| 581 | "%2u: %4u%4u%4u%4u%4u%4u%4u%4u\n", |
| 582 | i, bw[0], bw[1], bw[2], bw[3], |
| 583 | bw[4], bw[5], bw[6], bw[7]); |
| 584 | size -= temp; |
| 585 | next += temp; |
| 586 | } |
| 587 | list_for_each_entry(ps, &tt->ps_list, ps_list) { |
| 588 | temp = scnprintf(next, size, |
| 589 | "%s ep %02x: %4u @ %2u.%u+%u mask %04x\n", |
| 590 | dev_name(&ps->udev->dev), |
| 591 | ps->ep->desc.bEndpointAddress, |
| 592 | ps->tt_usecs, |
| 593 | ps->bw_phase, ps->phase_uf, |
| 594 | ps->bw_period, ps->cs_mask); |
| 595 | size -= temp; |
| 596 | next += temp; |
| 597 | } |
| 598 | } |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 599 | spin_unlock_irq(&ehci->lock); |
| 600 | |
| 601 | return next - buf->output_buf; |
| 602 | } |
| 603 | |
Geyslan G. Bem | 3fd2900 | 2016-01-25 22:45:08 -0300 | [diff] [blame] | 604 | static unsigned output_buf_tds_dir(char *buf, struct ehci_hcd *ehci, |
| 605 | struct ehci_qh_hw *hw, struct ehci_qh *qh, unsigned size) |
| 606 | { |
| 607 | u32 scratch = hc32_to_cpup(ehci, &hw->hw_info1); |
| 608 | struct ehci_qtd *qtd; |
| 609 | char *type = ""; |
| 610 | unsigned temp = 0; |
| 611 | |
| 612 | /* count tds, get ep direction */ |
| 613 | list_for_each_entry(qtd, &qh->qtd_list, qtd_list) { |
| 614 | temp++; |
| 615 | switch ((hc32_to_cpu(ehci, qtd->hw_token) >> 8) & 0x03) { |
| 616 | case 0: |
| 617 | type = "out"; |
| 618 | continue; |
| 619 | case 1: |
| 620 | type = "in"; |
| 621 | continue; |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | return scnprintf(buf, size, " (%c%d ep%d%s [%d/%d] q%d p%d)", |
| 626 | speed_char(scratch), scratch & 0x007f, |
| 627 | (scratch >> 8) & 0x000f, type, qh->ps.usecs, |
| 628 | qh->ps.c_usecs, temp, 0x7ff & (scratch >> 16)); |
| 629 | } |
| 630 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | #define DBG_SCHED_LIMIT 64 |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 632 | static ssize_t fill_periodic_buffer(struct debug_buffer *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | struct usb_hcd *hcd; |
| 635 | struct ehci_hcd *ehci; |
| 636 | unsigned long flags; |
| 637 | union ehci_shadow p, *seen; |
| 638 | unsigned temp, size, seen_count; |
| 639 | char *next; |
| 640 | unsigned i; |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 641 | __hc32 tag; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | |
Geyslan G. Bem | cb27252 | 2016-01-25 22:45:07 -0300 | [diff] [blame] | 643 | seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC); |
Greg Kroah-Hartman | 911fdb6 | 2015-04-30 11:32:50 +0200 | [diff] [blame] | 644 | if (!seen) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | return 0; |
| 646 | seen_count = 0; |
| 647 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 648 | hcd = bus_to_hcd(buf->bus); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 649 | ehci = hcd_to_ehci(hcd); |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 650 | next = buf->output_buf; |
| 651 | size = buf->alloc_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 653 | temp = scnprintf(next, size, "size = %d\n", ehci->periodic_size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | size -= temp; |
| 655 | next += temp; |
| 656 | |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 657 | /* |
| 658 | * dump a snapshot of the periodic schedule. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | * iso changes, interrupt usually doesn't. |
| 660 | */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 661 | spin_lock_irqsave(&ehci->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | for (i = 0; i < ehci->periodic_size; i++) { |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 663 | p = ehci->pshadow[i]; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 664 | if (likely(!p.ptr)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | continue; |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 666 | tag = Q_NEXT_TYPE(ehci, ehci->periodic[i]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 668 | temp = scnprintf(next, size, "%4d: ", i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | size -= temp; |
| 670 | next += temp; |
| 671 | |
| 672 | do { |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 673 | struct ehci_qh_hw *hw; |
| 674 | |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 675 | switch (hc32_to_cpu(ehci, tag)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | case Q_TYPE_QH: |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 677 | hw = p.qh->hw; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 678 | temp = scnprintf(next, size, " qh%d-%04x/%p", |
Alan Stern | ffa0248 | 2013-10-11 11:29:03 -0400 | [diff] [blame] | 679 | p.qh->ps.period, |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 680 | hc32_to_cpup(ehci, |
Alek Du | 3807e26 | 2009-07-14 07:23:29 +0800 | [diff] [blame] | 681 | &hw->hw_info2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | /* uframe masks */ |
David Brownell | 7dedacf | 2005-08-04 18:06:41 -0700 | [diff] [blame] | 683 | & (QH_CMASK | QH_SMASK), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | p.qh); |
| 685 | size -= temp; |
| 686 | next += temp; |
| 687 | /* don't repeat what follows this qh */ |
| 688 | for (temp = 0; temp < seen_count; temp++) { |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 689 | if (seen[temp].ptr != p.ptr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 690 | continue; |
Ming Lei | 3c4bb71 | 2008-09-18 23:06:38 +0800 | [diff] [blame] | 691 | if (p.qh->qh_next.ptr) { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 692 | temp = scnprintf(next, size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | " ..."); |
Ming Lei | 3c4bb71 | 2008-09-18 23:06:38 +0800 | [diff] [blame] | 694 | size -= temp; |
| 695 | next += temp; |
| 696 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | break; |
| 698 | } |
| 699 | /* show more info the first time around */ |
Ming Lei | 3c4bb71 | 2008-09-18 23:06:38 +0800 | [diff] [blame] | 700 | if (temp == seen_count) { |
Geyslan G. Bem | 3fd2900 | 2016-01-25 22:45:08 -0300 | [diff] [blame] | 701 | temp = output_buf_tds_dir(next, ehci, |
| 702 | hw, p.qh, size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | |
| 704 | if (seen_count < DBG_SCHED_LIMIT) |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 705 | seen[seen_count++].qh = p.qh; |
Geyslan G. Bem | 04b8ad4 | 2016-01-25 22:45:06 -0300 | [diff] [blame] | 706 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | temp = 0; |
Geyslan G. Bem | 04b8ad4 | 2016-01-25 22:45:06 -0300 | [diff] [blame] | 708 | } |
Alan Stern | 17dcfc9 | 2012-09-19 17:00:55 -0400 | [diff] [blame] | 709 | tag = Q_NEXT_TYPE(ehci, hw->hw_next); |
| 710 | p = p.qh->qh_next; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | break; |
| 712 | case Q_TYPE_FSTN: |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 713 | temp = scnprintf(next, size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | " fstn-%8x/%p", p.fstn->hw_prev, |
| 715 | p.fstn); |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 716 | tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | p = p.fstn->fstn_next; |
| 718 | break; |
| 719 | case Q_TYPE_ITD: |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 720 | temp = scnprintf(next, size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | " itd/%p", p.itd); |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 722 | tag = Q_NEXT_TYPE(ehci, p.itd->hw_next); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | p = p.itd->itd_next; |
| 724 | break; |
| 725 | case Q_TYPE_SITD: |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 726 | temp = scnprintf(next, size, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | " sitd%d-%04x/%p", |
Alan Stern | ffa0248 | 2013-10-11 11:29:03 -0400 | [diff] [blame] | 728 | p.sitd->stream->ps.period, |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 729 | hc32_to_cpup(ehci, &p.sitd->hw_uframe) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 730 | & 0x0000ffff, |
| 731 | p.sitd); |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 732 | tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 733 | p = p.sitd->sitd_next; |
| 734 | break; |
| 735 | } |
| 736 | size -= temp; |
| 737 | next += temp; |
| 738 | } while (p.ptr); |
| 739 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 740 | temp = scnprintf(next, size, "\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 741 | size -= temp; |
| 742 | next += temp; |
| 743 | } |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 744 | spin_unlock_irqrestore(&ehci->lock, flags); |
| 745 | kfree(seen); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 747 | return buf->alloc_size - size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 749 | #undef DBG_SCHED_LIMIT |
| 750 | |
Alan Stern | e879990 | 2011-08-18 16:31:30 -0400 | [diff] [blame] | 751 | static const char *rh_state_string(struct ehci_hcd *ehci) |
| 752 | { |
| 753 | switch (ehci->rh_state) { |
| 754 | case EHCI_RH_HALTED: |
| 755 | return "halted"; |
| 756 | case EHCI_RH_SUSPENDED: |
| 757 | return "suspended"; |
| 758 | case EHCI_RH_RUNNING: |
| 759 | return "running"; |
Alan Stern | c0c53db | 2012-07-11 11:21:48 -0400 | [diff] [blame] | 760 | case EHCI_RH_STOPPING: |
| 761 | return "stopping"; |
Alan Stern | e879990 | 2011-08-18 16:31:30 -0400 | [diff] [blame] | 762 | } |
| 763 | return "?"; |
| 764 | } |
| 765 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 766 | static ssize_t fill_registers_buffer(struct debug_buffer *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 767 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | struct usb_hcd *hcd; |
| 769 | struct ehci_hcd *ehci; |
| 770 | unsigned long flags; |
| 771 | unsigned temp, size, i; |
Geyslan G. Bem | 1cb1d1c | 2016-01-25 22:44:54 -0300 | [diff] [blame] | 772 | char *next, scratch[80]; |
| 773 | static char fmt[] = "%*s\n"; |
| 774 | static char label[] = ""; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 776 | hcd = bus_to_hcd(buf->bus); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 777 | ehci = hcd_to_ehci(hcd); |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 778 | next = buf->output_buf; |
| 779 | size = buf->alloc_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 781 | spin_lock_irqsave(&ehci->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 782 | |
Alan Stern | 541c7d4 | 2010-06-22 16:39:10 -0400 | [diff] [blame] | 783 | if (!HCD_HW_ACCESSIBLE(hcd)) { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 784 | size = scnprintf(next, size, |
Alan Stern | 2b70f07 | 2008-10-02 11:47:15 -0400 | [diff] [blame] | 785 | "bus %s, device %s\n" |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 786 | "%s\n" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | "SUSPENDED (no register access)\n", |
| 788 | hcd->self.controller->bus->name, |
Kay Sievers | 7071a3c | 2008-05-02 06:02:41 +0200 | [diff] [blame] | 789 | dev_name(hcd->self.controller), |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 790 | hcd->product_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 791 | goto done; |
| 792 | } |
| 793 | |
| 794 | /* Capability Registers */ |
Jan Andersson | c430131 | 2011-05-03 20:11:57 +0200 | [diff] [blame] | 795 | i = HC_VERSION(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 796 | temp = scnprintf(next, size, |
Alan Stern | 2b70f07 | 2008-10-02 11:47:15 -0400 | [diff] [blame] | 797 | "bus %s, device %s\n" |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 798 | "%s\n" |
Alan Stern | e879990 | 2011-08-18 16:31:30 -0400 | [diff] [blame] | 799 | "EHCI %x.%02x, rh state %s\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 800 | hcd->self.controller->bus->name, |
Kay Sievers | 7071a3c | 2008-05-02 06:02:41 +0200 | [diff] [blame] | 801 | dev_name(hcd->self.controller), |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 802 | hcd->product_desc, |
Alan Stern | e879990 | 2011-08-18 16:31:30 -0400 | [diff] [blame] | 803 | i >> 8, i & 0x0ff, rh_state_string(ehci)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | size -= temp; |
| 805 | next += temp; |
| 806 | |
yuan linyu | 2c93e79 | 2017-02-25 19:20:55 +0800 | [diff] [blame] | 807 | #ifdef CONFIG_USB_PCI |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 808 | /* EHCI 0.96 and later may have "extended capabilities" */ |
Yijing Wang | e10e6f4 | 2013-12-05 19:21:32 +0800 | [diff] [blame] | 809 | if (dev_is_pci(hcd->self.controller)) { |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 810 | struct pci_dev *pdev; |
| 811 | u32 offset, cap, cap2; |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 812 | unsigned count = 256 / 4; |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 813 | |
| 814 | pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 815 | offset = HCC_EXT_CAPS(ehci_readl(ehci, |
| 816 | &ehci->caps->hcc_params)); |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 817 | while (offset && count--) { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 818 | pci_read_config_dword(pdev, offset, &cap); |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 819 | switch (cap & 0xff) { |
| 820 | case 1: |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 821 | temp = scnprintf(next, size, |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 822 | "ownership %08x%s%s\n", cap, |
| 823 | (cap & (1 << 24)) ? " linux" : "", |
| 824 | (cap & (1 << 16)) ? " firmware" : ""); |
| 825 | size -= temp; |
| 826 | next += temp; |
| 827 | |
| 828 | offset += 4; |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 829 | pci_read_config_dword(pdev, offset, &cap2); |
| 830 | temp = scnprintf(next, size, |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 831 | "SMI sts/enable 0x%08x\n", cap2); |
| 832 | size -= temp; |
| 833 | next += temp; |
| 834 | break; |
| 835 | case 0: /* illegal reserved capability */ |
| 836 | cap = 0; |
| 837 | /* FALLTHROUGH */ |
| 838 | default: /* unknown */ |
| 839 | break; |
| 840 | } |
| 841 | temp = (cap >> 8) & 0xff; |
| 842 | } |
| 843 | } |
| 844 | #endif |
| 845 | |
Geyslan G. Bem | 0784b4d | 2016-01-25 22:44:55 -0300 | [diff] [blame] | 846 | /* FIXME interpret both types of params */ |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 847 | i = ehci_readl(ehci, &ehci->caps->hcs_params); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 848 | temp = scnprintf(next, size, "structural params 0x%08x\n", i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 849 | size -= temp; |
| 850 | next += temp; |
| 851 | |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 852 | i = ehci_readl(ehci, &ehci->caps->hcc_params); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 853 | temp = scnprintf(next, size, "capability params 0x%08x\n", i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 854 | size -= temp; |
| 855 | next += temp; |
| 856 | |
| 857 | /* Operational Registers */ |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 858 | temp = dbg_status_buf(scratch, sizeof(scratch), label, |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 859 | ehci_readl(ehci, &ehci->regs->status)); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 860 | temp = scnprintf(next, size, fmt, temp, scratch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 861 | size -= temp; |
| 862 | next += temp; |
| 863 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 864 | temp = dbg_command_buf(scratch, sizeof(scratch), label, |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 865 | ehci_readl(ehci, &ehci->regs->command)); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 866 | temp = scnprintf(next, size, fmt, temp, scratch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | size -= temp; |
| 868 | next += temp; |
| 869 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 870 | temp = dbg_intr_buf(scratch, sizeof(scratch), label, |
Benjamin Herrenschmidt | 083522d | 2006-12-15 06:54:08 +1100 | [diff] [blame] | 871 | ehci_readl(ehci, &ehci->regs->intr_enable)); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 872 | temp = scnprintf(next, size, fmt, temp, scratch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 873 | size -= temp; |
| 874 | next += temp; |
| 875 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 876 | temp = scnprintf(next, size, "uframe %04x\n", |
Alan Stern | 68aa95d | 2011-10-12 10:39:14 -0400 | [diff] [blame] | 877 | ehci_read_frame_index(ehci)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 878 | size -= temp; |
| 879 | next += temp; |
| 880 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 881 | for (i = 1; i <= HCS_N_PORTS(ehci->hcs_params); i++) { |
| 882 | temp = dbg_port_buf(scratch, sizeof(scratch), label, i, |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 883 | ehci_readl(ehci, |
| 884 | &ehci->regs->port_status[i - 1])); |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 885 | temp = scnprintf(next, size, fmt, temp, scratch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 886 | size -= temp; |
| 887 | next += temp; |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 888 | if (i == HCS_DEBUG_PORT(ehci->hcs_params) && ehci->debug) { |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 889 | temp = scnprintf(next, size, |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 890 | " debug control %08x\n", |
Stefan Roese | 6dbd682 | 2007-05-01 09:29:37 -0700 | [diff] [blame] | 891 | ehci_readl(ehci, |
| 892 | &ehci->debug->control)); |
David Brownell | d49d431 | 2005-05-07 13:21:50 -0700 | [diff] [blame] | 893 | size -= temp; |
| 894 | next += temp; |
| 895 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | } |
| 897 | |
Alan Stern | 6e01875 | 2013-03-22 13:31:45 -0400 | [diff] [blame] | 898 | if (!list_empty(&ehci->async_unlink)) { |
Alan Stern | 99ac5b1 | 2012-07-11 11:21:38 -0400 | [diff] [blame] | 899 | temp = scnprintf(next, size, "async unlink qh %p\n", |
Alan Stern | 6e01875 | 2013-03-22 13:31:45 -0400 | [diff] [blame] | 900 | list_first_entry(&ehci->async_unlink, |
| 901 | struct ehci_qh, unlink_node)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 902 | size -= temp; |
| 903 | next += temp; |
| 904 | } |
| 905 | |
| 906 | #ifdef EHCI_STATS |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 907 | temp = scnprintf(next, size, |
Alan Stern | 99ac5b1 | 2012-07-11 11:21:38 -0400 | [diff] [blame] | 908 | "irq normal %ld err %ld iaa %ld (lost %ld)\n", |
| 909 | ehci->stats.normal, ehci->stats.error, ehci->stats.iaa, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | ehci->stats.lost_iaa); |
| 911 | size -= temp; |
| 912 | next += temp; |
| 913 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 914 | temp = scnprintf(next, size, "complete %ld unlink %ld\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 915 | ehci->stats.complete, ehci->stats.unlink); |
| 916 | size -= temp; |
| 917 | next += temp; |
| 918 | #endif |
| 919 | |
| 920 | done: |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 921 | spin_unlock_irqrestore(&ehci->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 922 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 923 | return buf->alloc_size - size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 924 | } |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 925 | |
| 926 | static struct debug_buffer *alloc_buffer(struct usb_bus *bus, |
Geyslan G. Bem | c768ffb | 2016-01-25 22:45:00 -0300 | [diff] [blame] | 927 | ssize_t (*fill_func)(struct debug_buffer *)) |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 928 | { |
| 929 | struct debug_buffer *buf; |
| 930 | |
Geyslan G. Bem | 12ef7dd | 2016-01-25 22:45:05 -0300 | [diff] [blame] | 931 | buf = kzalloc(sizeof(*buf), GFP_KERNEL); |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 932 | |
| 933 | if (buf) { |
| 934 | buf->bus = bus; |
| 935 | buf->fill_func = fill_func; |
| 936 | mutex_init(&buf->mutex); |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 937 | buf->alloc_size = PAGE_SIZE; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 938 | } |
| 939 | |
| 940 | return buf; |
| 941 | } |
| 942 | |
| 943 | static int fill_buffer(struct debug_buffer *buf) |
| 944 | { |
| 945 | int ret = 0; |
| 946 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 947 | if (!buf->output_buf) |
Jesper Juhl | 73f35c6 | 2010-11-09 00:10:52 +0100 | [diff] [blame] | 948 | buf->output_buf = vmalloc(buf->alloc_size); |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 949 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 950 | if (!buf->output_buf) { |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 951 | ret = -ENOMEM; |
| 952 | goto out; |
| 953 | } |
| 954 | |
| 955 | ret = buf->fill_func(buf); |
| 956 | |
| 957 | if (ret >= 0) { |
| 958 | buf->count = ret; |
| 959 | ret = 0; |
| 960 | } |
| 961 | |
| 962 | out: |
| 963 | return ret; |
| 964 | } |
| 965 | |
| 966 | static ssize_t debug_output(struct file *file, char __user *user_buf, |
Geyslan G. Bem | c768ffb | 2016-01-25 22:45:00 -0300 | [diff] [blame] | 967 | size_t len, loff_t *offset) |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 968 | { |
| 969 | struct debug_buffer *buf = file->private_data; |
| 970 | int ret = 0; |
| 971 | |
| 972 | mutex_lock(&buf->mutex); |
| 973 | if (buf->count == 0) { |
| 974 | ret = fill_buffer(buf); |
| 975 | if (ret != 0) { |
| 976 | mutex_unlock(&buf->mutex); |
| 977 | goto out; |
| 978 | } |
| 979 | } |
| 980 | mutex_unlock(&buf->mutex); |
| 981 | |
| 982 | ret = simple_read_from_buffer(user_buf, len, offset, |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 983 | buf->output_buf, buf->count); |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 984 | |
| 985 | out: |
| 986 | return ret; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 987 | } |
| 988 | |
| 989 | static int debug_close(struct inode *inode, struct file *file) |
| 990 | { |
| 991 | struct debug_buffer *buf = file->private_data; |
| 992 | |
| 993 | if (buf) { |
Figo.zhang | f8086a0 | 2009-06-06 20:31:49 +0800 | [diff] [blame] | 994 | vfree(buf->output_buf); |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 995 | kfree(buf); |
| 996 | } |
| 997 | |
| 998 | return 0; |
| 999 | } |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 1000 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1001 | static int debug_async_open(struct inode *inode, struct file *file) |
| 1002 | { |
| 1003 | file->private_data = alloc_buffer(inode->i_private, fill_async_buffer); |
| 1004 | |
| 1005 | return file->private_data ? 0 : -ENOMEM; |
| 1006 | } |
| 1007 | |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 1008 | static int debug_bandwidth_open(struct inode *inode, struct file *file) |
| 1009 | { |
| 1010 | file->private_data = alloc_buffer(inode->i_private, |
| 1011 | fill_bandwidth_buffer); |
| 1012 | |
| 1013 | return file->private_data ? 0 : -ENOMEM; |
| 1014 | } |
| 1015 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1016 | static int debug_periodic_open(struct inode *inode, struct file *file) |
| 1017 | { |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 1018 | struct debug_buffer *buf; |
Geyslan G. Bem | 8d587d6 | 2016-01-25 22:45:03 -0300 | [diff] [blame] | 1019 | |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 1020 | buf = alloc_buffer(inode->i_private, fill_periodic_buffer); |
| 1021 | if (!buf) |
| 1022 | return -ENOMEM; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1023 | |
Geyslan G. Bem | c2fb017 | 2016-01-25 22:44:58 -0300 | [diff] [blame] | 1024 | buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8) * PAGE_SIZE; |
Ming Lei | 3c04e20 | 2008-09-18 23:06:21 +0800 | [diff] [blame] | 1025 | file->private_data = buf; |
| 1026 | return 0; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | static int debug_registers_open(struct inode *inode, struct file *file) |
| 1030 | { |
| 1031 | file->private_data = alloc_buffer(inode->i_private, |
| 1032 | fill_registers_buffer); |
| 1033 | |
| 1034 | return file->private_data ? 0 : -ENOMEM; |
| 1035 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1036 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 1037 | static inline void create_debug_files(struct ehci_hcd *ehci) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1038 | { |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1039 | struct usb_bus *bus = &ehci_to_hcd(ehci)->self; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1040 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1041 | ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root); |
| 1042 | if (!ehci->debug_dir) |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1043 | return; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1044 | |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1045 | if (!debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus, |
| 1046 | &debug_async_fops)) |
| 1047 | goto file_error; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1048 | |
Alan Stern | d0ce5c6 | 2013-10-11 11:29:13 -0400 | [diff] [blame] | 1049 | if (!debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus, |
| 1050 | &debug_bandwidth_fops)) |
| 1051 | goto file_error; |
| 1052 | |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1053 | if (!debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus, |
| 1054 | &debug_periodic_fops)) |
| 1055 | goto file_error; |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1056 | |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1057 | if (!debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus, |
| 1058 | &debug_registers_fops)) |
| 1059 | goto file_error; |
Alek Du | aa4d834 | 2010-06-04 15:47:54 +0800 | [diff] [blame] | 1060 | |
Tony Jones | 694cc20 | 2007-09-11 14:07:31 -0700 | [diff] [blame] | 1061 | return; |
| 1062 | |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1063 | file_error: |
| 1064 | debugfs_remove_recursive(ehci->debug_dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1065 | } |
| 1066 | |
Geyslan G. Bem | 668ab0d | 2016-01-25 22:44:53 -0300 | [diff] [blame] | 1067 | static inline void remove_debug_files(struct ehci_hcd *ehci) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1068 | { |
Ming Lei | 185c9bc | 2010-07-28 22:33:28 +0800 | [diff] [blame] | 1069 | debugfs_remove_recursive(ehci->debug_dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1070 | } |
| 1071 | |
Alan Stern | 128f8b3d | 2016-04-29 15:19:56 -0400 | [diff] [blame] | 1072 | #else /* CONFIG_DYNAMIC_DEBUG */ |
| 1073 | |
| 1074 | static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) { } |
| 1075 | static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) { } |
| 1076 | |
| 1077 | static inline void __maybe_unused dbg_qh(const char *label, |
| 1078 | struct ehci_hcd *ehci, struct ehci_qh *qh) { } |
| 1079 | |
| 1080 | static inline int __maybe_unused dbg_status_buf(const char *buf, |
| 1081 | unsigned int len, const char *label, u32 status) |
| 1082 | { return 0; } |
| 1083 | |
| 1084 | static inline int __maybe_unused dbg_command_buf(const char *buf, |
| 1085 | unsigned int len, const char *label, u32 command) |
| 1086 | { return 0; } |
| 1087 | |
| 1088 | static inline int __maybe_unused dbg_intr_buf(const char *buf, |
| 1089 | unsigned int len, const char *label, u32 enable) |
| 1090 | { return 0; } |
| 1091 | |
| 1092 | static inline int __maybe_unused dbg_port_buf(char *buf, |
| 1093 | unsigned int len, const char *label, int port, u32 status) |
| 1094 | { return 0; } |
| 1095 | |
| 1096 | static inline void dbg_status(struct ehci_hcd *ehci, const char *label, |
| 1097 | u32 status) { } |
| 1098 | static inline void dbg_cmd(struct ehci_hcd *ehci, const char *label, |
| 1099 | u32 command) { } |
| 1100 | static inline void dbg_port(struct ehci_hcd *ehci, const char *label, |
| 1101 | int port, u32 status) { } |
| 1102 | |
| 1103 | static inline void create_debug_files(struct ehci_hcd *bus) { } |
| 1104 | static inline void remove_debug_files(struct ehci_hcd *bus) { } |
| 1105 | |
Geyslan G. Bem | 93df42b | 2016-01-25 22:45:09 -0300 | [diff] [blame] | 1106 | #endif /* CONFIG_DYNAMIC_DEBUG */ |