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.)
Please merge to 2.4.24.pre.
- Dave
--- 1.11/drivers/usb/host/ehci-dbg.c Fri Dec 26 12:08:01 2003 +++ edited/drivers/usb/host/ehci-dbg.c Mon Dec 29 12:17:01 2003 @@ -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, --- 1.17/drivers/usb/host/ehci-hcd.c Fri Dec 26 12:08:01 2003 +++ edited/drivers/usb/host/ehci-hcd.c Mon Dec 29 12:17:01 2003 @@ -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 --- 1.7/drivers/usb/host/ehci-mem.c Tue Apr 1 12:23:15 2003 +++ edited/drivers/usb/host/ehci-mem.c Mon Dec 29 12:21:13 2003 @@ -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); } --- 1.18/drivers/usb/host/ehci-q.c Mon Oct 13 14:41:54 2003 +++ edited/drivers/usb/host/ehci-q.c Mon Dec 29 12:22:20 2003 @@ -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]); --- 1.11/drivers/usb/host/ehci.h Fri Dec 26 12:08:01 2003 +++ edited/drivers/usb/host/ehci.h Mon Dec 29 12:20:25 2003 @@ -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))); /*-------------------------------------------------------------------------*/