[SeaBIOS] usb ohci pipe free fix
Kevin O'Connor
kevin at koconnor.net
Sun Mar 4 04:33:10 CET 2012
On Sun, Mar 04, 2012 at 12:44:01AM +0100, Nils wrote:
> Op woensdag 22-02-2012 om 20:48 uur [tijdzone -0500], schreef Kevin
> O'Connor:
> > That's odd. It looks like the controller was running for 236ms and
> > then freezes. The only thing I can think of to track this down is to
> > sprinkle dprintf() statements through the code until we find what
> > caused the controller to stop.
> The controller freezes after the the lines 487 + 488 in usb-ohci.c:
>
> > for (i=startpos; i<ARRAY_SIZE(hcca->int_table); i+=ms)
> > hcca->int_table[i] = (u32)ed;
>
> If i comment them out the controller doesn't freeze anymore and the
> timeout disappears.
> Do you have a another suggestion or patch i could test?
I don't see anything wrong with the above code. (The barrier() should
be moved, but I don't see that causing the problems you're seeing.)
Getting more info may help. Something like the below.
Another thing you could try is forcing the "if (frameexp == 0)" branch
(by, for example, changing it to "if (1 || frameexp == 0)".
-Kevin
--- a/src/usb-ohci.c
+++ b/src/usb-ohci.c
@@ -482,18 +496,22 @@ ohci_alloc_intr_pipe(struct usb_pipe *dummy, int frameexp)
}
// Add to interrupt schedule.
- barrier();
struct ohci_hcca *hcca = (void*)cntl->regs->hcca;
if (frameexp == 0) {
// Add to existing interrupt entry.
struct ohci_ed *intr_ed = (void*)hcca->int_table[0];
ed->hwNextED = intr_ed->hwNextED;
+ barrier();
intr_ed->hwNextED = (u32)ed;
} else {
int startpos = 1<<(frameexp-1);
ed->hwNextED = hcca->int_table[startpos];
- for (i=startpos; i<ARRAY_SIZE(hcca->int_table); i+=ms)
+ dprintf(1, "update h=%p s=%d ms=%d ed=%p\n", hcca, startpos, ms, ed);
+ barrier();
+ for (i=startpos; i<ARRAY_SIZE(hcca->int_table); i+=ms) {
+ dprintf(1, "u i=%d o=%x n=%p\n", i, hcca->int_table[i], ed);
hcca->int_table[i] = (u32)ed;
+ }
}
return &pipe->pipe;
More information about the SeaBIOS
mailing list