[SeaBIOS] usb ohci pipe free fix

Kevin O'Connor kevin at koconnor.net
Wed Feb 22 01:31:05 CET 2012

On Tue, Feb 21, 2012 at 09:43:12PM +0100, Nils wrote:
> Op maandag 20-02-2012 om 13:17 uur [tijdzone -0500], schreef Kevin
> O'Connor:
> > I put together a patch to modify the way the OHCI controller does pipe
> > free'ing.  This is a preliminary patch (similar batch free'ing should
> > be done for the other controllers as well).  However, it might help
> > with the USB issues you've been having.
> > 
> Thanks for the patch.
> I tested this patch and the keyboard gets initialized now.
> The keyboard doesn't seem to react on keystroke yet tough and i still
> get a timeout error.(another bug?)

Well, that's not good.  I was assuming that the earlier problems were
due to a sloppy free, but it looks like something else is confusing
the controller.  The previous and current errors are probably related.
It's odd that control messages seem to be handled properly while the
frame_no and interrupt lists aren't.  To fix this, more debugging is
needed to see what's going wrong at what point.  You can start with
the patch below.


--- a/src/usb-ohci.c
+++ b/src/usb-ohci.c
@@ -123,6 +123,8 @@ ohci_waittick(struct usb_ohci_s *cntl)
     struct ohci_hcca *hcca = (void*)cntl->regs->hcca;
+    dprintf(1, "ohci wait: c=%x h=%p f=%d\n"
+            , cntl->regs->control, hcca, hcca->frame_no);
     u32 startframe = hcca->frame_no;
     u64 end = calc_future_tsc(1000 * 5);
     for (;;) {
@@ -214,6 +216,9 @@ start_ohci(struct usb_ohci_s *cntl, struct ohci_hcca *hcca)
               | OHCI_USB_OPER | oldrwc));
     readl(&cntl->regs->control); // flush writes
+    dprintf(1, "ohci init: c=%x h=%p h=%x f=%d\n"
+            , cntl->regs->control, hcca, cntl->regs->hcca, hcca->frame_no);
     return 0;

More information about the SeaBIOS mailing list