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