ChangeSet 1.1276.8.6, 2004/01/28 12:39:58-08:00, david-b@pacbell.net [PATCH] USB: ehci update: 1/3, misc David Brownell wrote: > This is minor "obvious" fixes plus two tweaks to help later > patches: > > - Interrupt QH has a link to the device, needed to implement > schedule trees (like OHCI does today) that are TT-aware > (essential for most keyboards and mice). > > - Export the macros that do high bandwidth packetsize stuff. > They're also needed for high bandwidth ISO transfers. > > It also morphs some existing "too much debug info" urb tracing > so it's kicked in by a manual #define EHCI_URB_TRACE. If some > generic version of that gets added to usbcore, this sort > of debug code can vanish (from all hcds). > > Please merge > > - Dave > Here's the 2.4 version of the patch ... it's the same, modulo some TT fault cleanup (needlessly different between the kernels) and lack of device refcounting. (Which can't cause new bugs in this circumstance, though old ones can still bite.) drivers/usb/host/ehci-dbg.c | 4 ++-- drivers/usb/host/ehci-hcd.c | 4 +++- drivers/usb/host/ehci-mem.c | 3 ++- drivers/usb/host/ehci-q.c | 26 +++++++++++++++++++++----- drivers/usb/host/ehci.h | 2 +- 5 files changed, 29 insertions(+), 10 deletions(-) diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c --- a/drivers/usb/host/ehci-dbg.c Wed Jan 28 13:36:20 2004 +++ b/drivers/usb/host/ehci-dbg.c Wed Jan 28 13:36:20 2004 @@ -126,7 +126,7 @@ #ifdef DEBUG static void __attribute__((__unused__)) -dbg_qtd (char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd) +dbg_qtd (const char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd) { ehci_dbg (ehci, "%s td %p n%08x %08x t%08x p0=%08x\n", label, qtd, cpu_to_le32p (&qtd->hw_next), @@ -142,7 +142,7 @@ } static void __attribute__((__unused__)) -dbg_qh (char *label, struct ehci_hcd *ehci, struct ehci_qh *qh) +dbg_qh (const char *label, struct ehci_hcd *ehci, struct ehci_qh *qh) { ehci_dbg (ehci, "%s qh %p n%08x info %x %x qtd %x\n", label, qh, qh->hw_next, qh->hw_info1, qh->hw_info2, diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c --- a/drivers/usb/host/ehci-hcd.c Wed Jan 28 13:36:20 2004 +++ b/drivers/usb/host/ehci-hcd.c Wed Jan 28 13:36:20 2004 @@ -98,7 +98,9 @@ static const char hcd_name [] = "ehci_hcd"; -// #define EHCI_VERBOSE_DEBUG +#undef EHCI_VERBOSE_DEBUG +#undef EHCI_URB_TRACE + // #define have_split_iso #ifdef DEBUG diff -Nru a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c --- a/drivers/usb/host/ehci-mem.c Wed Jan 28 13:36:20 2004 +++ b/drivers/usb/host/ehci-mem.c Wed Jan 28 13:36:20 2004 @@ -28,7 +28,7 @@ * - driver buffers, read/written by HC ... single shot DMA mapped * * There's also PCI "register" data, which is memory mapped. - * No memory seen by this driver is pagable. + * No memory seen by this driver is pageable. */ /*-------------------------------------------------------------------------*/ @@ -130,6 +130,7 @@ } if (qh->dummy) ehci_qtd_free (ehci, qh->dummy); + // usb_put_dev (qh->dev); pci_pool_free (ehci->qh_pool, qh, qh->qh_dma); } diff -Nru a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c --- a/drivers/usb/host/ehci-q.c Wed Jan 28 13:36:20 2004 +++ b/drivers/usb/host/ehci-q.c Wed Jan 28 13:36:20 2004 @@ -225,6 +225,16 @@ } spin_unlock (&urb->lock); +#ifdef EHCI_URB_TRACE + ehci_dbg (ehci, + "%s %s urb %p ep%d%s status %d len %d/%d\n", + __FUNCTION__, urb->dev->devpath, urb, + usb_pipeendpoint (urb->pipe), + usb_pipein (urb->pipe) ? "in" : "out", + urb->status, + urb->actual_length, urb->transfer_buffer_length); +#endif + /* complete() can reenter this HCD */ spin_unlock (&ehci->lock); usb_hcd_giveback_urb (&ehci->hcd, urb, regs); @@ -673,6 +683,10 @@ qh->period = urb->interval; } + + /* support for tt scheduling */ + // qh->dev = usb_get_dev (urb->dev); + qh->dev = urb->dev; } /* using TT? */ @@ -732,8 +746,6 @@ usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); return qh; } -#undef hb_mult -#undef hb_packet /*-------------------------------------------------------------------------*/ @@ -929,10 +941,14 @@ if (usb_pipein (urb->pipe) && !usb_pipecontrol (urb->pipe)) epnum |= 0x10; - ehci_vdbg (ehci, "submit_async urb %p len %d ep%d%s qtd %p [qh %p]\n", - urb, urb->transfer_buffer_length, - epnum & 0x0f, (epnum & 0x10) ? "in" : "out", +#ifdef EHCI_URB_TRACE + ehci_dbg (ehci, + "%s %s urb %p ep%d%s len %d, qtd %p [qh %p]\n", + __FUNCTION__, urb->dev->devpath, urb, + epnum & 0x0f, usb_pipein (urb->pipe) ? "in" : "out", + urb->transfer_buffer_length, qtd, dev ? dev->ep [epnum] : (void *)~0); +#endif spin_lock_irqsave (&ehci->lock, flags); qh = qh_append_tds (ehci, urb, qtd_list, epnum, &dev->ep [epnum]); diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h --- a/drivers/usb/host/ehci.h Wed Jan 28 13:36:20 2004 +++ b/drivers/usb/host/ehci.h Wed Jan 28 13:36:20 2004 @@ -381,7 +381,7 @@ unsigned short period; /* polling interval */ unsigned short start; /* where polling starts */ #define NO_FRAME ((unsigned short)~0) /* pick new start */ - + struct usb_device *dev; /* access to TT */ } __attribute__ ((aligned (32))); /*-------------------------------------------------------------------------*/