Skip to content

Commit 6987bf7

Browse files
committed
ohci debuging
1 parent aba82b6 commit 6987bf7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

hw/usb/hcd-ohci.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static inline void ohci_intr_update(OHCIState *ohci)
249249
(ohci->intr_status & ohci->intr))
250250
level = 1;
251251

252+
qemu_set_irq(ohci->irq, 0);
252253
qemu_set_irq(ohci->irq, level);
253254
}
254255

@@ -346,6 +347,7 @@ static void ohci_soft_reset(OHCIState *ohci)
346347
ohci->frame_number = 0;
347348
ohci->pstart = 0;
348349
ohci->lst = OHCI_LS_THRESH;
350+
printf("OHCI RESET\n");
349351
}
350352

351353
void ohci_hard_reset(OHCIState *ohci)
@@ -573,12 +575,14 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
573575

574576
if (addr == 0) {
575577
ohci_die(ohci);
578+
printf("%d\n", __LINE__);
576579
return 1;
577580
}
578581

579582
if (ohci_read_iso_td(ohci, addr, &iso_td)) {
580583
trace_usb_ohci_iso_td_read_failed(addr);
581584
ohci_die(ohci);
585+
printf("%d\n", __LINE__);
582586
return 1;
583587
}
584588

@@ -599,6 +603,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
599603

600604
if (relative_frame_number < 0) {
601605
trace_usb_ohci_iso_td_relative_frame_number_neg(relative_frame_number);
606+
printf("%d\n", __LINE__);
602607
return 1;
603608
} else if (relative_frame_number > frame_count) {
604609
/* ISO TD expired - retire the TD to the Done Queue and continue with
@@ -607,8 +612,13 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
607612
frame_count);
608613
if (OHCI_CC_DATAOVERRUN == OHCI_BM(iso_td.flags, TD_CC)) {
609614
/* avoid infinite loop */
615+
printf("%d\n", __LINE__);
610616
return 1;
611617
}
618+
dir = OHCI_BM(ed->flags, ED_D);
619+
printf("OHCI_CC_DATAOVERRUN %d current_frame: %d starting_frame: %d. frame_count: %d, dir %d\n",
620+
relative_frame_number, ohci->frame_number, starting_frame, frame_count, dir);
621+
assert(0);
612622
OHCI_SET_BM(iso_td.flags, TD_CC, OHCI_CC_DATAOVERRUN);
613623
ed->head &= ~OHCI_DPTR_MASK;
614624
ed->head |= (iso_td.next & OHCI_DPTR_MASK);
@@ -640,11 +650,14 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
640650
break;
641651
default:
642652
trace_usb_ohci_iso_td_bad_direction(dir);
653+
printf("%d\n", __LINE__);
643654
return 1;
644655
}
645656

646657
if (!iso_td.bp || !iso_td.be) {
647658
trace_usb_ohci_iso_td_bad_bp_be(iso_td.bp, iso_td.be);
659+
printf("%d\n", __LINE__);
660+
assert(0);
648661
return 1;
649662
}
650663

@@ -659,11 +672,13 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
659672
((relative_frame_number < frame_count) &&
660673
!(OHCI_BM(next_offset, TD_PSW_CC) & 0xe))) {
661674
trace_usb_ohci_iso_td_bad_cc_not_accessed(start_offset, next_offset);
675+
printf("%d\n", __LINE__);
662676
return 1;
663677
}
664678

665679
if ((relative_frame_number < frame_count) && (start_offset > next_offset)) {
666680
trace_usb_ohci_iso_td_bad_cc_overrun(start_offset, next_offset);
681+
printf("%d\n", __LINE__);
667682
return 1;
668683
}
669684

@@ -691,7 +706,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
691706

692707
if (start_addr > end_addr) {
693708
trace_usb_ohci_iso_td_bad_cc_overrun(start_addr, end_addr);
694-
return 1;
709+
//return 1;
695710
}
696711

697712
if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK)) {
@@ -708,6 +723,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)
708723
if (ohci_copy_iso_td(ohci, start_addr, end_addr, buf, len,
709724
DMA_DIRECTION_TO_DEVICE)) {
710725
ohci_die(ohci);
726+
printf("%d\n", __LINE__);
711727
return 1;
712728
}
713729
}
@@ -1185,6 +1201,7 @@ static void ohci_frame_boundary(void *opaque)
11851201
if (ohci_read_hcca(ohci, ohci->hcca, &hcca)) {
11861202
trace_usb_ohci_hcca_read_error(ohci->hcca);
11871203
ohci_die(ohci);
1204+
assert(0);
11881205
return;
11891206
}
11901207

@@ -1194,6 +1211,8 @@ static void ohci_frame_boundary(void *opaque)
11941211

11951212
n = ohci->frame_number & 0x1f;
11961213
ohci_service_ed_list(ohci, le32_to_cpu(hcca.intr[n]));
1214+
} else {
1215+
assert(0);
11971216
}
11981217

11991218
/* Cancel all pending packets if either of the lists has been disabled. */

0 commit comments

Comments
 (0)