Commit 412c9e6a authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] ehci, more diagnostics use dev_*() macros

This reduces the quantity of messages, by using the
newer dev_*() macros, and by deleting some messages.
parent d8808735
...@@ -45,7 +45,8 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label) ...@@ -45,7 +45,8 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
{ {
u32 params = readl (&ehci->caps->hcs_params); u32 params = readl (&ehci->caps->hcs_params);
dbg ("%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d", ehci_dbg (ehci,
"%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n",
label, params, label, params,
HCS_DEBUG_PORT (params), HCS_DEBUG_PORT (params),
HCS_INDICATOR (params) ? " ind" : "", HCS_INDICATOR (params) ? " ind" : "",
...@@ -67,9 +68,8 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label) ...@@ -67,9 +68,8 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf))); ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
strcat(buf, tmp); strcat(buf, tmp);
} }
dbg ("%s: %s portroute %s", ehci_dbg (ehci, "%s portroute %s\n",
hcd_to_bus (&ehci->hcd)->bus_name, label, label, buf);
buf);
} }
} }
#else #else
...@@ -88,19 +88,16 @@ static void dbg_hcc_params (struct ehci_hcd *ehci, char *label) ...@@ -88,19 +88,16 @@ static void dbg_hcc_params (struct ehci_hcd *ehci, char *label)
{ {
u32 params = readl (&ehci->caps->hcc_params); u32 params = readl (&ehci->caps->hcc_params);
if (HCC_EXT_CAPS (params)) {
// EHCI 0.96 ... could interpret these (legacy?)
dbg ("%s extended capabilities at pci %2x",
label, HCC_EXT_CAPS (params));
}
if (HCC_ISOC_CACHE (params)) { if (HCC_ISOC_CACHE (params)) {
dbg ("%s hcc_params %04x caching frame %s%s%s", ehci_dbg (ehci,
"%s hcc_params %04x caching frame %s%s%s\n",
label, params, label, params,
HCC_PGM_FRAMELISTLEN (params) ? "256/512/1024" : "1024", HCC_PGM_FRAMELISTLEN (params) ? "256/512/1024" : "1024",
HCC_CANPARK (params) ? " park" : "", HCC_CANPARK (params) ? " park" : "",
HCC_64BIT_ADDR (params) ? " 64 bit addr" : ""); HCC_64BIT_ADDR (params) ? " 64 bit addr" : "");
} else { } else {
dbg ("%s hcc_params %04x caching %d uframes %s%s%s", ehci_dbg (ehci,
"%s hcc_params %04x thresh %d uframes %s%s%s\n",
label, label,
params, params,
HCC_ISOC_THRES (params), HCC_ISOC_THRES (params),
...@@ -246,19 +243,19 @@ dbg_port_buf (char *buf, unsigned len, char *label, int port, u32 status) ...@@ -246,19 +243,19 @@ dbg_port_buf (char *buf, unsigned len, char *label, int port, u32 status)
#define dbg_status(ehci, label, status) { \ #define dbg_status(ehci, label, status) { \
char _buf [80]; \ char _buf [80]; \
dbg_status_buf (_buf, sizeof _buf, label, status); \ dbg_status_buf (_buf, sizeof _buf, label, status); \
dbg ("%s", _buf); \ ehci_dbg (ehci, "%s\n", _buf); \
} }
#define dbg_cmd(ehci, label, command) { \ #define dbg_cmd(ehci, label, command) { \
char _buf [80]; \ char _buf [80]; \
dbg_command_buf (_buf, sizeof _buf, label, command); \ dbg_command_buf (_buf, sizeof _buf, label, command); \
dbg ("%s", _buf); \ ehci_dbg (ehci, "%s\n", _buf); \
} }
#define dbg_port(hcd, label, port, status) { \ #define dbg_port(ehci, label, port, status) { \
char _buf [80]; \ char _buf [80]; \
dbg_port_buf (_buf, sizeof _buf, label, port, status); \ dbg_port_buf (_buf, sizeof _buf, label, port, status); \
dbg ("%s", _buf); \ ehci_dbg (ehci, "%s\n", _buf); \
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
...@@ -262,7 +262,7 @@ static void ehci_watchdog (unsigned long param) ...@@ -262,7 +262,7 @@ static void ehci_watchdog (unsigned long param)
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
/* guard against lost IAA, which wedges everything */ /* guard against lost IAA, which wedges everything */
ehci_irq (&ehci->hcd); ehci_irq (&ehci->hcd);
/* unlink the last qh after it's idled a while */ /* stop async processing after it's idled a while */
if (ehci->async_idle) { if (ehci->async_idle) {
start_unlink_async (ehci, ehci->async); start_unlink_async (ehci, ehci->async);
ehci->async_idle = 0; ehci->async_idle = 0;
...@@ -289,12 +289,13 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap) ...@@ -289,12 +289,13 @@ static int bios_handoff (struct ehci_hcd *ehci, int where, u32 cap)
pci_read_config_dword (ehci->hcd.pdev, where, &cap); pci_read_config_dword (ehci->hcd.pdev, where, &cap);
} while ((cap & (1 << 16)) && msec); } while ((cap & (1 << 16)) && msec);
if (cap & (1 << 16)) { if (cap & (1 << 16)) {
info ("BIOS handoff failed (%d, %04x)", where, cap); dev_info (*ehci->hcd.controller,
"BIOS handoff failed (%d, %04x)\n",
where, cap);
return 1; return 1;
} }
dbg ("BIOS handoff succeeded"); ehci_dbg (ehci, "BIOS handoff succeeded\n");
} else }
dbg ("BIOS handoff not needed");
return 0; return 0;
} }
...@@ -325,14 +326,15 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -325,14 +326,15 @@ static int ehci_start (struct usb_hcd *hcd)
u32 cap; u32 cap;
pci_read_config_dword (ehci->hcd.pdev, temp, &cap); pci_read_config_dword (ehci->hcd.pdev, temp, &cap);
dbg ("capability %04x at %02x", cap, temp); ehci_dbg (ehci, "capability %04x at %02x\n", cap, temp);
switch (cap & 0xff) { switch (cap & 0xff) {
case 1: /* BIOS/SMM/... handoff */ case 1: /* BIOS/SMM/... handoff */
if (bios_handoff (ehci, temp, cap) != 0) if (bios_handoff (ehci, temp, cap) != 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
break; break;
case 0: /* illegal reserved capability */ case 0: /* illegal reserved capability */
warn ("illegal capability!"); dev_warn (*ehci->hcd.controller,
"illegal capability!\n");
cap = 0; cap = 0;
/* FALLTHROUGH */ /* FALLTHROUGH */
default: /* unknown */ default: /* unknown */
...@@ -404,7 +406,8 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -404,7 +406,8 @@ static int ehci_start (struct usb_hcd *hcd)
if (HCC_64BIT_ADDR (hcc_params)) { if (HCC_64BIT_ADDR (hcc_params)) {
writel (0, &ehci->regs->segment); writel (0, &ehci->regs->segment);
if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL)) if (!pci_set_dma_mask (ehci->hcd.pdev, 0xffffffffffffffffULL))
info ("enabled 64bit PCI DMA (DAC)"); dev_info (*ehci->hcd.controller,
"enabled 64bit PCI DMA (DAC)\n");
} }
/* clear interrupt enables, set irq latency */ /* clear interrupt enables, set irq latency */
...@@ -451,10 +454,10 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -451,10 +454,10 @@ static int ehci_start (struct usb_hcd *hcd)
/* PCI Serial Bus Release Number is at 0x60 offset */ /* PCI Serial Bus Release Number is at 0x60 offset */
pci_read_config_byte (hcd->pdev, 0x60, &tempbyte); pci_read_config_byte (hcd->pdev, 0x60, &tempbyte);
temp = readw (&ehci->caps->hci_version); temp = readw (&ehci->caps->hci_version);
info ("USB %x.%x support enabled, EHCI rev %x.%02x, %s %s", dev_info (*hcd->controller,
"USB %x.%x enabled, EHCI %x.%02x, driver %s\n",
((tempbyte & 0xf0)>>4), (tempbyte & 0x0f), ((tempbyte & 0xf0)>>4), (tempbyte & 0x0f),
temp >> 8, temp & 0xff, temp >> 8, temp & 0xff, DRIVER_VERSION);
hcd_name, DRIVER_VERSION);
/* /*
* From here on, khubd concurrently accesses the root * From here on, khubd concurrently accesses the root
...@@ -486,13 +489,13 @@ static void ehci_stop (struct usb_hcd *hcd) ...@@ -486,13 +489,13 @@ static void ehci_stop (struct usb_hcd *hcd)
{ {
struct ehci_hcd *ehci = hcd_to_ehci (hcd); struct ehci_hcd *ehci = hcd_to_ehci (hcd);
dbg ("%s: stop", hcd_to_bus (hcd)->bus_name); ehci_dbg (ehci, "stop\n");
/* no more interrupts ... */ /* no more interrupts ... */
if (hcd->state == USB_STATE_RUNNING) if (hcd->state == USB_STATE_RUNNING)
ehci_ready (ehci); ehci_ready (ehci);
if (in_interrupt ()) /* should not happen!! */ if (in_interrupt ()) /* should not happen!! */
err ("stopped %s!", RUN_CONTEXT); dev_err (*hcd->controller, "stopped %s!\n", RUN_CONTEXT);
else else
del_timer_sync (&ehci->watchdog); del_timer_sync (&ehci->watchdog);
ehci_reset (ehci); ehci_reset (ehci);
...@@ -508,9 +511,9 @@ static void ehci_stop (struct usb_hcd *hcd) ...@@ -508,9 +511,9 @@ static void ehci_stop (struct usb_hcd *hcd)
ehci_mem_cleanup (ehci); ehci_mem_cleanup (ehci);
#ifdef EHCI_STATS #ifdef EHCI_STATS
dbg ("irq normal %ld err %ld reclaim %ld", ehci_dbg (ehci, "irq normal %ld err %ld reclaim %ld\n",
ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim); ehci->stats.normal, ehci->stats.error, ehci->stats.reclaim);
dbg ("complete %ld unlink %ld", ehci_dbg (ehci, "complete %ld unlink %ld\n",
ehci->stats.complete, ehci->stats.unlink); ehci->stats.complete, ehci->stats.unlink);
#endif #endif
...@@ -754,8 +757,8 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) ...@@ -754,8 +757,8 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv; struct ehci_qh *qh = (struct ehci_qh *) urb->hcpriv;
unsigned long flags; unsigned long flags;
dbg ("%s urb_dequeue %p qh %p state %d", ehci_vdbg (ehci, "urb_dequeue %p qh %p state %d\n",
hcd_to_bus (hcd)->bus_name, urb, qh, qh->qh_state); urb, qh, qh->qh_state);
switch (usb_pipetype (urb->pipe)) { switch (usb_pipetype (urb->pipe)) {
// case PIPE_CONTROL: // case PIPE_CONTROL:
...@@ -998,7 +1001,6 @@ MODULE_LICENSE ("GPL"); ...@@ -998,7 +1001,6 @@ MODULE_LICENSE ("GPL");
static int __init init (void) static int __init init (void)
{ {
dbg (DRIVER_INFO);
if (usb_disabled()) if (usb_disabled())
return -ENODEV; return -ENODEV;
......
...@@ -40,18 +40,15 @@ static int check_reset_complete ( ...@@ -40,18 +40,15 @@ static int check_reset_complete (
/* if reset finished and it's still not enabled -- handoff */ /* if reset finished and it's still not enabled -- handoff */
if (!(port_status & PORT_PE)) { if (!(port_status & PORT_PE)) {
dbg ("%s port %d full speed, give to companion, 0x%x", ehci_dbg (ehci, "port %d full speed --> companion\n",
hcd_to_bus (&ehci->hcd)->bus_name, index + 1);
index + 1, port_status);
// what happens if HCS_N_CC(params) == 0 ? // what happens if HCS_N_CC(params) == 0 ?
port_status |= PORT_OWNER; port_status |= PORT_OWNER;
writel (port_status, &ehci->regs->port_status [index]); writel (port_status, &ehci->regs->port_status [index]);
} else } else
dbg ("%s port %d high speed", ehci_dbg (ehci, "port %d high speed\n", index + 1);
hcd_to_bus (&ehci->hcd)->bus_name,
index + 1);
return port_status; return port_status;
} }
...@@ -277,7 +274,7 @@ static int ehci_hub_control ( ...@@ -277,7 +274,7 @@ static int ehci_hub_control (
#ifndef EHCI_VERBOSE_DEBUG #ifndef EHCI_VERBOSE_DEBUG
if (status & ~0xffff) /* only if wPortChange is interesting */ if (status & ~0xffff) /* only if wPortChange is interesting */
#endif #endif
dbg_port (hcd, "GetStatus", wIndex + 1, temp); dbg_port (ehci, "GetStatus", wIndex + 1, temp);
// we "know" this alignment is good, caller used kmalloc()... // we "know" this alignment is good, caller used kmalloc()...
*((u32 *) buf) = cpu_to_le32 (status); *((u32 *) buf) = cpu_to_le32 (status);
break; break;
...@@ -313,14 +310,12 @@ static int ehci_hub_control ( ...@@ -313,14 +310,12 @@ static int ehci_hub_control (
/* line status bits may report this as low speed */ /* line status bits may report this as low speed */
if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT
&& PORT_USB11 (temp)) { && PORT_USB11 (temp)) {
dbg ("%s port %d low speed, give to companion", ehci_dbg (ehci,
hcd_to_bus (&ehci->hcd)->bus_name, "port %d low speed --> companion\n",
wIndex + 1); wIndex + 1);
temp |= PORT_OWNER; temp |= PORT_OWNER;
} else { } else {
vdbg ("%s port %d reset", ehci_vdbg (ehci, "port %d reset", wIndex + 1);
hcd_to_bus (&ehci->hcd)->bus_name,
wIndex + 1);
temp |= PORT_RESET; temp |= PORT_RESET;
temp &= ~PORT_PE; temp &= ~PORT_PE;
......
...@@ -103,7 +103,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags) ...@@ -103,7 +103,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
/* dummy td enables safe urb queuing */ /* dummy td enables safe urb queuing */
qh->dummy = ehci_qtd_alloc (ehci, flags); qh->dummy = ehci_qtd_alloc (ehci, flags);
if (qh->dummy == 0) { if (qh->dummy == 0) {
dbg ("no dummy td"); ehci_dbg (ehci, "no dummy td\n");
pci_pool_free (ehci->qh_pool, qh, qh->qh_dma); pci_pool_free (ehci->qh_pool, qh, qh->qh_dma);
qh = 0; qh = 0;
} }
...@@ -113,19 +113,17 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags) ...@@ -113,19 +113,17 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
/* to share a qh (cpu threads, or hc) */ /* to share a qh (cpu threads, or hc) */
static inline struct ehci_qh *qh_get (/* ehci, */ struct ehci_qh *qh) static inline struct ehci_qh *qh_get (/* ehci, */ struct ehci_qh *qh)
{ {
// dbg ("get %p (%d++)", qh, qh->refcount.counter);
atomic_inc (&qh->refcount); atomic_inc (&qh->refcount);
return qh; return qh;
} }
static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh) static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh)
{ {
// dbg ("put %p (--%d)", qh, qh->refcount.counter);
if (!atomic_dec_and_test (&qh->refcount)) if (!atomic_dec_and_test (&qh->refcount))
return; return;
/* clean qtds first, and know this is not linked */ /* clean qtds first, and know this is not linked */
if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) { if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
dbg ("unused qh not empty!"); ehci_dbg (ehci, "unused qh not empty!\n");
BUG (); BUG ();
} }
if (qh->dummy) if (qh->dummy)
......
...@@ -130,8 +130,9 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token) ...@@ -130,8 +130,9 @@ static inline void qtd_copy_status (struct urb *urb, size_t length, u32 token)
else /* unknown */ else /* unknown */
urb->status = -EPROTO; urb->status = -EPROTO;
dbg ("ep %d-%s qtd token %08x --> status %d", ehci_vdbg (ehci,
/* devpath */ "dev%d ep%d%s qtd token %08x --> status %d\n",
usb_pipedev (urb->pipe),
usb_pipeendpoint (urb->pipe), usb_pipeendpoint (urb->pipe),
usb_pipein (urb->pipe) ? "in" : "out", usb_pipein (urb->pipe) ? "in" : "out",
token, urb->status); token, urb->status);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment