Lines Matching +full:ati +full:- +full:mode

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
35 * http://developer.intel.com/technology/usb/download/ehci-r096.pdf
37 * http://developer.intel.com/technology/usb/download/ehci-r10.pdf
154 cb(bus, &sc->sc_hw.pframes_pc, &sc->sc_hw.pframes_pg, in ehci_iterate_hw_softc()
157 cb(bus, &sc->sc_hw.terminate_pc, &sc->sc_hw.terminate_pg, in ehci_iterate_hw_softc()
160 cb(bus, &sc->sc_hw.async_start_pc, &sc->sc_hw.async_start_pg, in ehci_iterate_hw_softc()
164 cb(bus, sc->sc_hw.intr_start_pc + i, in ehci_iterate_hw_softc()
165 sc->sc_hw.intr_start_pg + i, in ehci_iterate_hw_softc()
170 cb(bus, sc->sc_hw.isoc_hs_start_pc + i, in ehci_iterate_hw_softc()
171 sc->sc_hw.isoc_hs_start_pg + i, in ehci_iterate_hw_softc()
176 cb(bus, sc->sc_hw.isoc_fs_start_pc + i, in ehci_iterate_hw_softc()
177 sc->sc_hw.isoc_fs_start_pg + i, in ehci_iterate_hw_softc()
193 if (sc->sc_vendor_post_reset != NULL) in ehci_reset()
194 sc->sc_vendor_post_reset(sc); in ehci_reset()
198 device_printf(sc->sc_bus.bdev, "reset timeout\n"); in ehci_reset()
218 * Table 2-9 in the EHCI spec says this will result in ehci_hcreset()
221 device_printf(sc->sc_bus.bdev, "stop timeout\n"); in ehci_hcreset()
239 DPRINTF("HCC uses 64-bit structures\n"); in ehci_init_sub()
245 usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); in ehci_init_sub()
248 usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); in ehci_init_sub()
252 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); in ehci_init_sub()
273 device_printf(sc->sc_bus.bdev, "run timeout\n"); in ehci_init_sub()
293 usb_callout_init_mtx(&sc->sc_tmo_pcd, &sc->sc_bus.bus_mtx, 0); in ehci_init()
294 usb_callout_init_mtx(&sc->sc_tmo_poll, &sc->sc_bus.bus_mtx, 0); in ehci_init()
296 sc->sc_offs = EHCI_CAPLENGTH(EREAD4(sc, EHCI_CAPLEN_HCIVERSION)); in ehci_init()
300 sc->sc_flags |= EHCI_SCFLG_IAADBUG; in ehci_init()
302 sc->sc_flags |= EHCI_SCFLG_LOSTINTRBUG; in ehci_init()
309 device_printf(sc->sc_bus.bdev, "EHCI version %x.%x\n", in ehci_init()
315 sc->sc_noport = EHCI_HCS_N_PORTS(sparams); in ehci_init()
316 sc->sc_bus.usbrev = USB_REV_2_0; in ehci_init()
318 if (!(sc->sc_flags & EHCI_SCFLG_DONTRESET)) { in ehci_init()
321 device_get_nameunit(sc->sc_bus.bdev)); in ehci_init()
325 device_printf(sc->sc_bus.bdev, "reset timeout\n"); in ehci_init()
331 * use current frame-list-size selection 0: 1024*4 bytes 1: 512*4 in ehci_init()
335 device_printf(sc->sc_bus.bdev, "invalid frame-list-size\n"); in ehci_init()
339 sc->sc_bus.methods = &ehci_bus_methods; in ehci_init()
341 sc->sc_eintrs = EHCI_NORMAL_INTRS; in ehci_init()
346 usbd_get_page(&sc->sc_hw.terminate_pc, 0, &buf_res); in ehci_init()
350 sc->sc_terminate_self = htohc32(sc, buf_res.physaddr); in ehci_init()
353 qh->qtd_next = in ehci_init()
355 qh->qtd_altnext = in ehci_init()
357 qh->qtd_status = in ehci_init()
364 usbd_get_page(sc->sc_hw.intr_start_pc + i, 0, &buf_res); in ehci_init()
370 qh->page_cache = sc->sc_hw.intr_start_pc + i; in ehci_init()
374 sc->sc_intr_p_last[i] = qh; in ehci_init()
376 qh->qh_self = in ehci_init()
380 qh->qh_endp = in ehci_init()
382 qh->qh_endphub = in ehci_init()
384 qh->qh_curqtd = 0; in ehci_init()
386 qh->qh_qtd.qtd_next = in ehci_init()
388 qh->qh_qtd.qtd_altnext = in ehci_init()
390 qh->qh_qtd.qtd_status = in ehci_init()
407 qh_x = sc->sc_intr_p_last[x]; in ehci_init()
408 qh_y = sc->sc_intr_p_last[y]; in ehci_init()
413 qh_x->qh_link = qh_y->qh_self; in ehci_init()
423 qh = sc->sc_intr_p_last[0]; in ehci_init()
426 qh->qh_link = htohc32(sc, EHCI_LINK_TERMINATE); in ehci_init()
432 usbd_get_page(sc->sc_hw.isoc_fs_start_pc + i, 0, &buf_res); in ehci_init()
438 sitd->page_cache = sc->sc_hw.isoc_fs_start_pc + i; in ehci_init()
442 sc->sc_isoc_fs_p_last[i] = sitd; in ehci_init()
446 sitd->sitd_self = in ehci_init()
450 sitd->sitd_back = in ehci_init()
453 sitd->sitd_next = in ehci_init()
454 sc->sc_intr_p_last[i | (EHCI_VIRTUAL_FRAMELIST_COUNT / 2)]->qh_self; in ehci_init()
456 usbd_get_page(sc->sc_hw.isoc_hs_start_pc + i, 0, &buf_res); in ehci_init()
462 itd->page_cache = sc->sc_hw.isoc_hs_start_pc + i; in ehci_init()
466 sc->sc_isoc_hs_p_last[i] = itd; in ehci_init()
470 itd->itd_self = in ehci_init()
474 itd->itd_next = in ehci_init()
475 sitd->sitd_self; in ehci_init()
478 usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); in ehci_init()
487 * pframes -> high speed isochronous -> in ehci_init()
488 * full speed isochronous -> interrupt QH's in ehci_init()
491 pframes[i] = sc->sc_isoc_hs_p_last in ehci_init()
492 [i & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1)]->itd_self; in ehci_init()
495 usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); in ehci_init()
504 qh->page_cache = &sc->sc_hw.async_start_pc; in ehci_init()
508 sc->sc_async_p_last = qh; in ehci_init()
512 qh->qh_self = in ehci_init()
517 qh->qh_endp = in ehci_init()
519 qh->qh_endphub = htohc32(sc, EHCI_QH_SET_MULT(1)); in ehci_init()
520 qh->qh_link = qh->qh_self; in ehci_init()
521 qh->qh_curqtd = 0; in ehci_init()
524 qh->qh_qtd.qtd_next = htohc32(sc, EHCI_LINK_TERMINATE); in ehci_init()
525 qh->qh_qtd.qtd_altnext = htohc32(sc, EHCI_LINK_TERMINATE); in ehci_init()
526 qh->qh_qtd.qtd_status = htohc32(sc, EHCI_QTD_HALTED); in ehci_init()
530 usb_bus_mem_flush_all(&sc->sc_bus, &ehci_iterate_hw_softc); in ehci_init()
534 ehci_dump_sqh(sc, sc->sc_async_p_last); in ehci_init()
543 ehci_do_poll(&sc->sc_bus); in ehci_init()
554 USB_BUS_LOCK(&sc->sc_bus); in ehci_detach()
556 usb_callout_stop(&sc->sc_tmo_pcd); in ehci_detach()
557 usb_callout_stop(&sc->sc_tmo_poll); in ehci_detach()
560 USB_BUS_UNLOCK(&sc->sc_bus); in ehci_detach()
569 usb_callout_drain(&sc->sc_tmo_pcd); in ehci_detach()
570 usb_callout_drain(&sc->sc_tmo_poll); in ehci_detach()
592 ehci_do_poll(&sc->sc_bus); in ehci_resume()
669 for (i = 1; i <= sc->sc_noport; i++) { in ehci_dump_regs()
710 ehci_dump_link(sc, qtd->qtd_next, 0); in ehci_dump_qtd()
712 ehci_dump_link(sc, qtd->qtd_altnext, 0); in ehci_dump_qtd()
714 s = hc32toh(sc, qtd->qtd_status); in ehci_dump_qtd()
721 (s & EHCI_QTD_HALTED) ? "-HALTED" : "", in ehci_dump_qtd()
722 (s & EHCI_QTD_BUFERR) ? "-BUFERR" : "", in ehci_dump_qtd()
723 (s & EHCI_QTD_BABBLE) ? "-BABBLE" : "", in ehci_dump_qtd()
724 (s & EHCI_QTD_XACTERR) ? "-XACTERR" : "", in ehci_dump_qtd()
725 (s & EHCI_QTD_MISSEDMICRO) ? "-MISSED" : "", in ehci_dump_qtd()
726 (s & EHCI_QTD_SPLITXSTATE) ? "-SPLIT" : "", in ehci_dump_qtd()
727 (s & EHCI_QTD_PINGSTATE) ? "-PING" : ""); in ehci_dump_qtd()
731 hc32toh(sc, qtd->qtd_buffer[s])); in ehci_dump_qtd()
735 hc32toh(sc, qtd->qtd_buffer_hi[s])); in ehci_dump_qtd()
744 usb_pc_cpu_invalidate(sqtd->page_cache); in ehci_dump_sqtd()
745 printf("QTD(%p) at 0x%08x:\n", sqtd, hc32toh(sc, sqtd->qtd_self)); in ehci_dump_sqtd()
747 temp = (sqtd->qtd_next & htohc32(sc, EHCI_LINK_TERMINATE)) ? 1 : 0; in ehci_dump_sqtd()
758 for (i = 0; sqtd && (i < 20) && !stop; sqtd = sqtd->obj_next, i++) { in ehci_dump_sqtds()
772 usb_pc_cpu_invalidate(qh->page_cache); in ehci_dump_sqh()
773 printf("QH(%p) at 0x%08x:\n", qh, hc32toh(sc, qh->qh_self) & ~0x1F); in ehci_dump_sqh()
775 ehci_dump_link(sc, qh->qh_link, 1); in ehci_dump_sqh()
777 endp = hc32toh(sc, qh->qh_endp); in ehci_dump_sqh()
786 endphub = hc32toh(sc, qh->qh_endphub); in ehci_dump_sqh()
793 ehci_dump_link(sc, qh->qh_curqtd, 0); in ehci_dump_sqh()
796 ehci_dump_qtd(sc, (void *)&qh->qh_qtd); in ehci_dump_sqh()
802 usb_pc_cpu_invalidate(sitd->page_cache); in ehci_dump_sitd()
803 printf("SITD(%p) at 0x%08x\n", sitd, hc32toh(sc, sitd->sitd_self) & ~0x1F); in ehci_dump_sitd()
804 printf(" next=0x%08x\n", hc32toh(sc, sitd->sitd_next)); in ehci_dump_sitd()
806 hc32toh(sc, sitd->sitd_portaddr), in ehci_dump_sitd()
807 (sitd->sitd_portaddr & htohc32(sc, EHCI_SITD_SET_DIR_IN)) in ehci_dump_sitd()
809 EHCI_SITD_GET_ADDR(hc32toh(sc, sitd->sitd_portaddr)), in ehci_dump_sitd()
810 EHCI_SITD_GET_ENDPT(hc32toh(sc, sitd->sitd_portaddr)), in ehci_dump_sitd()
811 EHCI_SITD_GET_PORT(hc32toh(sc, sitd->sitd_portaddr)), in ehci_dump_sitd()
812 EHCI_SITD_GET_HUBA(hc32toh(sc, sitd->sitd_portaddr))); in ehci_dump_sitd()
813 printf(" mask=0x%08x\n", hc32toh(sc, sitd->sitd_mask)); in ehci_dump_sitd()
814 printf(" status=0x%08x <%s> len=0x%x\n", hc32toh(sc, sitd->sitd_status), in ehci_dump_sitd()
815 (sitd->sitd_status & htohc32(sc, EHCI_SITD_ACTIVE)) ? "ACTIVE" : "", in ehci_dump_sitd()
816 EHCI_SITD_GET_LEN(hc32toh(sc, sitd->sitd_status))); in ehci_dump_sitd()
818 hc32toh(sc, sitd->sitd_back), in ehci_dump_sitd()
819 hc32toh(sc, sitd->sitd_bp[0]), in ehci_dump_sitd()
820 hc32toh(sc, sitd->sitd_bp[1]), in ehci_dump_sitd()
821 hc32toh(sc, sitd->sitd_bp_hi[0]), in ehci_dump_sitd()
822 hc32toh(sc, sitd->sitd_bp_hi[1])); in ehci_dump_sitd()
828 usb_pc_cpu_invalidate(itd->page_cache); in ehci_dump_itd()
829 printf("ITD(%p) at 0x%08x\n", itd, hc32toh(sc, itd->itd_self) & ~0x1F); in ehci_dump_itd()
830 printf(" next=0x%08x\n", hc32toh(sc, itd->itd_next)); in ehci_dump_itd()
831 printf(" status[0]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[0]), in ehci_dump_itd()
832 (itd->itd_status[0] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
833 printf(" status[1]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[1]), in ehci_dump_itd()
834 (itd->itd_status[1] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
835 printf(" status[2]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[2]), in ehci_dump_itd()
836 (itd->itd_status[2] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
837 printf(" status[3]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[3]), in ehci_dump_itd()
838 (itd->itd_status[3] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
839 printf(" status[4]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[4]), in ehci_dump_itd()
840 (itd->itd_status[4] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
841 printf(" status[5]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[5]), in ehci_dump_itd()
842 (itd->itd_status[5] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
843 printf(" status[6]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[6]), in ehci_dump_itd()
844 (itd->itd_status[6] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
845 printf(" status[7]=0x%08x; <%s>\n", hc32toh(sc, itd->itd_status[7]), in ehci_dump_itd()
846 (itd->itd_status[7] & htohc32(sc, EHCI_ITD_ACTIVE)) ? "ACTIVE" : ""); in ehci_dump_itd()
847 printf(" bp[0]=0x%08x\n", hc32toh(sc, itd->itd_bp[0])); in ehci_dump_itd()
849 EHCI_ITD_GET_ADDR(hc32toh(sc, itd->itd_bp[0])), in ehci_dump_itd()
850 EHCI_ITD_GET_ENDPT(hc32toh(sc, itd->itd_bp[0]))); in ehci_dump_itd()
851 printf(" bp[1]=0x%08x\n", hc32toh(sc, itd->itd_bp[1])); in ehci_dump_itd()
853 (hc32toh(sc, itd->itd_bp[1]) & EHCI_ITD_SET_DIR_IN) ? "in" : "out", in ehci_dump_itd()
854 EHCI_ITD_GET_MPL(hc32toh(sc, itd->itd_bp[1]))); in ehci_dump_itd()
856 hc32toh(sc, itd->itd_bp[2]), in ehci_dump_itd()
857 hc32toh(sc, itd->itd_bp[3]), in ehci_dump_itd()
858 hc32toh(sc, itd->itd_bp[4]), in ehci_dump_itd()
859 hc32toh(sc, itd->itd_bp[5]), in ehci_dump_itd()
860 hc32toh(sc, itd->itd_bp[6])); in ehci_dump_itd()
863 hc32toh(sc, itd->itd_bp_hi[0]), in ehci_dump_itd()
864 hc32toh(sc, itd->itd_bp_hi[1]), in ehci_dump_itd()
865 hc32toh(sc, itd->itd_bp_hi[2]), in ehci_dump_itd()
866 hc32toh(sc, itd->itd_bp_hi[3]), in ehci_dump_itd()
867 hc32toh(sc, itd->itd_bp_hi[4]), in ehci_dump_itd()
868 hc32toh(sc, itd->itd_bp_hi[5]), in ehci_dump_itd()
869 hc32toh(sc, itd->itd_bp_hi[6])); in ehci_dump_itd()
881 (EHCI_VIRTUAL_FRAMELIST_COUNT - 1); in ehci_dump_isoc()
886 itd = sc->sc_isoc_hs_p_last[pos]; in ehci_dump_isoc()
887 sitd = sc->sc_isoc_fs_p_last[pos]; in ehci_dump_isoc()
889 while (itd && max && max--) { in ehci_dump_isoc()
891 itd = itd->prev; in ehci_dump_isoc()
894 while (sitd && max && max--) { in ehci_dump_isoc()
896 sitd = sitd->prev; in ehci_dump_isoc()
910 usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); in ehci_transfer_intr_enqueue()
913 if (xfer->timeout != 0) { in ehci_transfer_intr_enqueue()
914 usbd_transfer_timeout_ms(xfer, &ehci_timeout, xfer->timeout); in ehci_transfer_intr_enqueue()
924 /* (sc->sc_bus.mtx) must be locked */ in _ehci_append_fs_td()
926 std->next = last->next; in _ehci_append_fs_td()
927 std->sitd_next = last->sitd_next; in _ehci_append_fs_td()
929 std->prev = last; in _ehci_append_fs_td()
931 usb_pc_cpu_flush(std->page_cache); in _ehci_append_fs_td()
934 * the last->next->prev is never followed: std->next->prev = std; in _ehci_append_fs_td()
936 last->next = std; in _ehci_append_fs_td()
937 last->sitd_next = std->sitd_self; in _ehci_append_fs_td()
939 usb_pc_cpu_flush(last->page_cache); in _ehci_append_fs_td()
950 /* (sc->sc_bus.mtx) must be locked */ in _ehci_append_hs_td()
952 std->next = last->next; in _ehci_append_hs_td()
953 std->itd_next = last->itd_next; in _ehci_append_hs_td()
955 std->prev = last; in _ehci_append_hs_td()
957 usb_pc_cpu_flush(std->page_cache); in _ehci_append_hs_td()
960 * the last->next->prev is never followed: std->next->prev = std; in _ehci_append_hs_td()
962 last->next = std; in _ehci_append_hs_td()
963 last->itd_next = std->itd_self; in _ehci_append_hs_td()
965 usb_pc_cpu_flush(last->page_cache); in _ehci_append_hs_td()
976 if (sqh->prev != NULL) { in _ehci_append_qh()
981 /* (sc->sc_bus.mtx) must be locked */ in _ehci_append_qh()
983 sqh->next = last->next; in _ehci_append_qh()
984 sqh->qh_link = last->qh_link; in _ehci_append_qh()
986 sqh->prev = last; in _ehci_append_qh()
988 usb_pc_cpu_flush(sqh->page_cache); in _ehci_append_qh()
991 * the last->next->prev is never followed: sqh->next->prev = sqh; in _ehci_append_qh()
994 last->next = sqh; in _ehci_append_qh()
995 last->qh_link = sqh->qh_self; in _ehci_append_qh()
997 usb_pc_cpu_flush(last->page_cache); in _ehci_append_qh()
1008 /* (sc->sc_bus.mtx) must be locked */ in _ehci_remove_fs_td()
1010 std->prev->next = std->next; in _ehci_remove_fs_td()
1011 std->prev->sitd_next = std->sitd_next; in _ehci_remove_fs_td()
1013 usb_pc_cpu_flush(std->prev->page_cache); in _ehci_remove_fs_td()
1015 if (std->next) { in _ehci_remove_fs_td()
1016 std->next->prev = std->prev; in _ehci_remove_fs_td()
1017 usb_pc_cpu_flush(std->next->page_cache); in _ehci_remove_fs_td()
1019 return ((last == std) ? std->prev : last); in _ehci_remove_fs_td()
1028 /* (sc->sc_bus.mtx) must be locked */ in _ehci_remove_hs_td()
1030 std->prev->next = std->next; in _ehci_remove_hs_td()
1031 std->prev->itd_next = std->itd_next; in _ehci_remove_hs_td()
1033 usb_pc_cpu_flush(std->prev->page_cache); in _ehci_remove_hs_td()
1035 if (std->next) { in _ehci_remove_hs_td()
1036 std->next->prev = std->prev; in _ehci_remove_hs_td()
1037 usb_pc_cpu_flush(std->next->page_cache); in _ehci_remove_hs_td()
1039 return ((last == std) ? std->prev : last); in _ehci_remove_hs_td()
1048 /* (sc->sc_bus.mtx) must be locked */ in _ehci_remove_qh()
1051 if (sqh->prev) { in _ehci_remove_qh()
1052 sqh->prev->next = sqh->next; in _ehci_remove_qh()
1053 sqh->prev->qh_link = sqh->qh_link; in _ehci_remove_qh()
1055 usb_pc_cpu_flush(sqh->prev->page_cache); in _ehci_remove_qh()
1057 if (sqh->next) { in _ehci_remove_qh()
1058 sqh->next->prev = sqh->prev; in _ehci_remove_qh()
1059 usb_pc_cpu_flush(sqh->next->page_cache); in _ehci_remove_qh()
1061 last = ((last == sqh) ? sqh->prev : last); in _ehci_remove_qh()
1063 sqh->prev = 0; in _ehci_remove_qh()
1065 usb_pc_cpu_flush(sqh->page_cache); in _ehci_remove_qh()
1077 dt = (actlen / xfer->max_packet_size) & 1; in ehci_data_toggle_update()
1080 rem = actlen % xfer->max_packet_size; in ehci_data_toggle_update()
1089 xfer->endpoint->toggle_next ^= dt; in ehci_data_toggle_update()
1095 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_non_isoc_done_sub()
1101 td = xfer->td_transfer_cache; in ehci_non_isoc_done_sub()
1102 td_alt_next = td->alt_next; in ehci_non_isoc_done_sub()
1104 if (xfer->aframes != xfer->nframes) { in ehci_non_isoc_done_sub()
1105 usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); in ehci_non_isoc_done_sub()
1108 usb_pc_cpu_invalidate(td->page_cache); in ehci_non_isoc_done_sub()
1109 status = hc32toh(sc, td->qtd_status); in ehci_non_isoc_done_sub()
1117 if (len > td->len) { in ehci_non_isoc_done_sub()
1120 "0x%04x/0x%04x bytes\n", len, td->len); in ehci_non_isoc_done_sub()
1122 } else if (xfer->aframes != xfer->nframes) { in ehci_non_isoc_done_sub()
1123 xfer->frlengths[xfer->aframes] += td->len - len; in ehci_non_isoc_done_sub()
1125 ehci_data_toggle_update(xfer, td->len - len, td->len); in ehci_non_isoc_done_sub()
1129 if (((void *)td) == xfer->td_transfer_last) { in ehci_non_isoc_done_sub()
1141 if (xfer->flags_int.short_frames_ok) { in ehci_non_isoc_done_sub()
1143 td = td->alt_next; in ehci_non_isoc_done_sub()
1150 td = td->obj_next; in ehci_non_isoc_done_sub()
1152 if (td->alt_next != td_alt_next) { in ehci_non_isoc_done_sub()
1160 xfer->td_transfer_cache = td; in ehci_non_isoc_done_sub()
1166 xfer->address, xfer->endpointno, xfer->aframes, in ehci_non_isoc_done_sub()
1178 if ((xfer->xroot->udev->parent_hs_hub != NULL) || in ehci_non_isoc_done_sub()
1179 (xfer->xroot->udev->address != 0)) { in ehci_non_isoc_done_sub()
1196 xfer, xfer->endpoint); in ehci_non_isoc_done()
1200 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_non_isoc_done()
1202 ehci_dump_sqtds(sc, xfer->td_transfer_first); in ehci_non_isoc_done()
1208 qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; in ehci_non_isoc_done()
1210 usb_pc_cpu_invalidate(qh->page_cache); in ehci_non_isoc_done()
1214 xfer->td_transfer_cache = xfer->td_transfer_first; in ehci_non_isoc_done()
1216 if (xfer->flags_int.control_xfr) { in ehci_non_isoc_done()
1217 if (xfer->flags_int.control_hdr) { in ehci_non_isoc_done()
1220 xfer->aframes = 1; in ehci_non_isoc_done()
1222 if (xfer->td_transfer_cache == NULL) { in ehci_non_isoc_done()
1226 while (xfer->aframes != xfer->nframes) { in ehci_non_isoc_done()
1228 xfer->aframes++; in ehci_non_isoc_done()
1230 if (xfer->td_transfer_cache == NULL) { in ehci_non_isoc_done()
1235 if (xfer->flags_int.control_xfr && in ehci_non_isoc_done()
1236 !xfer->flags_int.control_act) { in ehci_non_isoc_done()
1243 /*------------------------------------------------------------------------*
1249 *------------------------------------------------------------------------*/
1253 const struct usb_pipe_methods *methods = xfer->endpoint->methods; in ehci_check_transfer()
1254 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_check_transfer()
1265 td = xfer->td_transfer_last; in ehci_check_transfer()
1266 usb_pc_cpu_invalidate(td->page_cache); in ehci_check_transfer()
1267 status = hc32toh(sc, td->sitd_status); in ehci_check_transfer()
1271 td = xfer->td_transfer_first; in ehci_check_transfer()
1272 usb_pc_cpu_invalidate(td->page_cache); in ehci_check_transfer()
1273 status |= hc32toh(sc, td->sitd_status); in ehci_check_transfer()
1285 td = xfer->td_transfer_last; in ehci_check_transfer()
1286 usb_pc_cpu_invalidate(td->page_cache); in ehci_check_transfer()
1287 status = td->itd_status[0]; in ehci_check_transfer()
1288 status |= td->itd_status[1]; in ehci_check_transfer()
1289 status |= td->itd_status[2]; in ehci_check_transfer()
1290 status |= td->itd_status[3]; in ehci_check_transfer()
1291 status |= td->itd_status[4]; in ehci_check_transfer()
1292 status |= td->itd_status[5]; in ehci_check_transfer()
1293 status |= td->itd_status[6]; in ehci_check_transfer()
1294 status |= td->itd_status[7]; in ehci_check_transfer()
1297 td = xfer->td_transfer_first; in ehci_check_transfer()
1298 usb_pc_cpu_invalidate(td->page_cache); in ehci_check_transfer()
1299 status |= td->itd_status[0]; in ehci_check_transfer()
1300 status |= td->itd_status[1]; in ehci_check_transfer()
1301 status |= td->itd_status[2]; in ehci_check_transfer()
1302 status |= td->itd_status[3]; in ehci_check_transfer()
1303 status |= td->itd_status[4]; in ehci_check_transfer()
1304 status |= td->itd_status[5]; in ehci_check_transfer()
1305 status |= td->itd_status[6]; in ehci_check_transfer()
1306 status |= td->itd_status[7]; in ehci_check_transfer()
1317 /* non-isochronous transfer */ in ehci_check_transfer()
1323 td = xfer->td_transfer_cache; in ehci_check_transfer()
1325 qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; in ehci_check_transfer()
1327 usb_pc_cpu_invalidate(qh->page_cache); in ehci_check_transfer()
1329 status = hc32toh(sc, qh->qh_qtd.qtd_status); in ehci_check_transfer()
1336 usb_pc_cpu_invalidate(td->page_cache); in ehci_check_transfer()
1337 status = hc32toh(sc, td->qtd_status); in ehci_check_transfer()
1345 xfer->td_transfer_cache = td; in ehci_check_transfer()
1351 if (((void *)td) == xfer->td_transfer_last) { in ehci_check_transfer()
1365 if (xfer->flags_int.short_frames_ok) { in ehci_check_transfer()
1367 if (td->alt_next) { in ehci_check_transfer()
1368 td = td->alt_next; in ehci_check_transfer()
1375 td = td->obj_next; in ehci_check_transfer()
1392 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in ehci_pcd_enable()
1394 sc->sc_eintrs |= EHCI_STS_PCD; in ehci_pcd_enable()
1395 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); in ehci_pcd_enable()
1409 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in ehci_interrupt_poll()
1421 * Some EHCI chips from VIA / ATI seem to trigger interrupts before
1424 * transaction completion - when we scan the active list the
1442 /*------------------------------------------------------------------------*
1443 * ehci_interrupt - EHCI interrupt handler
1445 * NOTE: Do not access "sc->sc_bus.bdev" inside the interrupt handler,
1446 * hence the interrupt handler will be setup before "sc->sc_bus.bdev"
1448 *------------------------------------------------------------------------*/
1454 USB_BUS_LOCK(&sc->sc_bus); in ehci_interrupt()
1469 if (!(status & sc->sc_eintrs)) { in ehci_interrupt()
1474 status &= sc->sc_eintrs; in ehci_interrupt()
1489 sc->sc_eintrs &= ~EHCI_STS_PCD; in ehci_interrupt()
1490 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); in ehci_interrupt()
1495 usb_callout_reset(&sc->sc_tmo_pcd, hz, in ehci_interrupt()
1502 sc->sc_eintrs &= ~status; in ehci_interrupt()
1503 EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); in ehci_interrupt()
1509 if (sc->sc_flags & EHCI_SCFLG_LOSTINTRBUG) { in ehci_interrupt()
1510 usb_callout_reset(&sc->sc_tmo_poll, hz / 128, in ehci_interrupt()
1515 USB_BUS_UNLOCK(&sc->sc_bus); in ehci_interrupt()
1528 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in ehci_timeout()
1539 USB_BUS_LOCK(&sc->sc_bus); in ehci_do_poll()
1541 USB_BUS_UNLOCK(&sc->sc_bus); in ehci_do_poll()
1559 terminate = temp->sc->sc_terminate_self; in ehci_setup_standard_chain_sub()
1560 qtd_altnext = temp->sc->sc_terminate_self; in ehci_setup_standard_chain_sub()
1563 shortpkt_old = temp->shortpkt; in ehci_setup_standard_chain_sub()
1564 len_old = temp->len; in ehci_setup_standard_chain_sub()
1569 td = temp->td; in ehci_setup_standard_chain_sub()
1570 td_next = temp->td_next; in ehci_setup_standard_chain_sub()
1573 if (temp->len == 0) { in ehci_setup_standard_chain_sub()
1574 if (temp->shortpkt) { in ehci_setup_standard_chain_sub()
1579 temp->shortpkt = 1; in ehci_setup_standard_chain_sub()
1583 average = temp->average; in ehci_setup_standard_chain_sub()
1585 if (temp->len < average) { in ehci_setup_standard_chain_sub()
1586 if (temp->len % temp->max_frame_size) { in ehci_setup_standard_chain_sub()
1587 temp->shortpkt = 1; in ehci_setup_standard_chain_sub()
1589 average = temp->len; in ehci_setup_standard_chain_sub()
1599 td_next = td->obj_next; in ehci_setup_standard_chain_sub()
1601 /* check if we are pre-computing */ in ehci_setup_standard_chain_sub()
1606 temp->len -= average; in ehci_setup_standard_chain_sub()
1612 td->qtd_status = in ehci_setup_standard_chain_sub()
1613 temp->qtd_status | in ehci_setup_standard_chain_sub()
1614 htohc32(temp->sc, EHCI_QTD_IOC | in ehci_setup_standard_chain_sub()
1618 if (temp->auto_data_toggle == 0) { in ehci_setup_standard_chain_sub()
1621 temp->qtd_status ^= in ehci_setup_standard_chain_sub()
1622 htohc32(temp->sc, EHCI_QTD_TOGGLE_MASK); in ehci_setup_standard_chain_sub()
1624 td->len = 0; in ehci_setup_standard_chain_sub()
1627 td->qtd_buffer[0] = 0; in ehci_setup_standard_chain_sub()
1628 td->qtd_buffer[1] = 0; in ehci_setup_standard_chain_sub()
1629 td->qtd_buffer[2] = 0; in ehci_setup_standard_chain_sub()
1630 td->qtd_buffer[3] = 0; in ehci_setup_standard_chain_sub()
1631 td->qtd_buffer[4] = 0; in ehci_setup_standard_chain_sub()
1632 td->qtd_buffer_hi[0] = 0; in ehci_setup_standard_chain_sub()
1633 td->qtd_buffer_hi[1] = 0; in ehci_setup_standard_chain_sub()
1634 td->qtd_buffer_hi[2] = 0; in ehci_setup_standard_chain_sub()
1635 td->qtd_buffer_hi[3] = 0; in ehci_setup_standard_chain_sub()
1636 td->qtd_buffer_hi[4] = 0; in ehci_setup_standard_chain_sub()
1640 if (temp->auto_data_toggle == 0) { in ehci_setup_standard_chain_sub()
1643 if (howmany(average, temp->max_frame_size) & 1) { in ehci_setup_standard_chain_sub()
1644 temp->qtd_status ^= in ehci_setup_standard_chain_sub()
1645 htohc32(temp->sc, EHCI_QTD_TOGGLE_MASK); in ehci_setup_standard_chain_sub()
1648 td->len = average; in ehci_setup_standard_chain_sub()
1652 temp->len -= average; in ehci_setup_standard_chain_sub()
1656 usbd_get_page(temp->pc, buf_offset, &buf_res); in ehci_setup_standard_chain_sub()
1657 td->qtd_buffer[0] = in ehci_setup_standard_chain_sub()
1658 htohc32(temp->sc, buf_res.physaddr); in ehci_setup_standard_chain_sub()
1659 td->qtd_buffer_hi[0] = 0; in ehci_setup_standard_chain_sub()
1664 average -= EHCI_PAGE_SIZE; in ehci_setup_standard_chain_sub()
1666 usbd_get_page(temp->pc, buf_offset, &buf_res); in ehci_setup_standard_chain_sub()
1667 td->qtd_buffer[x] = in ehci_setup_standard_chain_sub()
1668 htohc32(temp->sc, in ehci_setup_standard_chain_sub()
1670 td->qtd_buffer_hi[x] = 0; in ehci_setup_standard_chain_sub()
1683 usbd_get_page(temp->pc, buf_offset - 1, &buf_res); in ehci_setup_standard_chain_sub()
1684 td->qtd_buffer[x] = in ehci_setup_standard_chain_sub()
1685 htohc32(temp->sc, in ehci_setup_standard_chain_sub()
1687 td->qtd_buffer_hi[x] = 0; in ehci_setup_standard_chain_sub()
1691 td->qtd_buffer[x] = 0; in ehci_setup_standard_chain_sub()
1692 td->qtd_buffer_hi[x] = 0; in ehci_setup_standard_chain_sub()
1698 td->qtd_next = td_next->qtd_self; in ehci_setup_standard_chain_sub()
1700 td->qtd_altnext = qtd_altnext; in ehci_setup_standard_chain_sub()
1701 td->alt_next = td_alt_next; in ehci_setup_standard_chain_sub()
1703 usb_pc_cpu_flush(td->page_cache); in ehci_setup_standard_chain_sub()
1710 if (temp->last_frame) { in ehci_setup_standard_chain_sub()
1716 if (temp->setup_alt_next) { in ehci_setup_standard_chain_sub()
1717 qtd_altnext = td_next->qtd_self; in ehci_setup_standard_chain_sub()
1724 temp->shortpkt = shortpkt_old; in ehci_setup_standard_chain_sub()
1725 temp->len = len_old; in ehci_setup_standard_chain_sub()
1728 temp->td = td; in ehci_setup_standard_chain_sub()
1729 temp->td_next = td_next; in ehci_setup_standard_chain_sub()
1744 xfer->address, UE_GET_ADDR(xfer->endpointno), in ehci_setup_standard_chain()
1745 xfer->sumlen, usbd_get_speed(xfer->xroot->udev)); in ehci_setup_standard_chain()
1747 temp.average = xfer->max_hc_frame_size; in ehci_setup_standard_chain()
1748 temp.max_frame_size = xfer->max_frame_size; in ehci_setup_standard_chain()
1749 temp.sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_setup_standard_chain()
1752 xfer->flags_int.curr_dma_set ^= 1; in ehci_setup_standard_chain()
1755 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in ehci_setup_standard_chain()
1757 xfer->td_transfer_first = td; in ehci_setup_standard_chain()
1758 xfer->td_transfer_cache = td; in ehci_setup_standard_chain()
1764 temp.setup_alt_next = xfer->flags_int.short_frames_ok; in ehci_setup_standard_chain()
1766 if (xfer->flags_int.control_xfr) { in ehci_setup_standard_chain()
1767 if (xfer->endpoint->toggle_next) { in ehci_setup_standard_chain()
1777 if ((xfer->xroot->udev->parent_hs_hub != NULL) || in ehci_setup_standard_chain()
1778 (xfer->xroot->udev->address != 0)) { in ehci_setup_standard_chain()
1785 if (xfer->flags_int.control_xfr) { in ehci_setup_standard_chain()
1786 if (xfer->flags_int.control_hdr) { in ehci_setup_standard_chain()
1787 xfer->endpoint->toggle_next = 0; in ehci_setup_standard_chain()
1796 temp.len = xfer->frlengths[0]; in ehci_setup_standard_chain()
1797 temp.pc = xfer->frbuffers + 0; in ehci_setup_standard_chain()
1800 if (xfer->nframes == 1) { in ehci_setup_standard_chain()
1802 if (xfer->flags_int.control_act) { in ehci_setup_standard_chain()
1814 while (x != xfer->nframes) { in ehci_setup_standard_chain()
1817 temp.len = xfer->frlengths[x]; in ehci_setup_standard_chain()
1818 temp.pc = xfer->frbuffers + x; in ehci_setup_standard_chain()
1822 if (x == xfer->nframes) { in ehci_setup_standard_chain()
1823 if (xfer->flags_int.control_xfr) { in ehci_setup_standard_chain()
1825 if (xfer->flags_int.control_act) { in ehci_setup_standard_chain()
1848 temp.shortpkt = (xfer->flags.force_short_xfer) ? 0 : 1; in ehci_setup_standard_chain()
1854 (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) ? in ehci_setup_standard_chain()
1865 if (xfer->flags_int.control_xfr && in ehci_setup_standard_chain()
1866 !xfer->flags_int.control_act) { in ehci_setup_standard_chain()
1875 (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) ? in ehci_setup_standard_chain()
1894 td->qtd_next = htohc32(temp.sc, EHCI_LINK_TERMINATE); in ehci_setup_standard_chain()
1895 td->qtd_altnext = htohc32(temp.sc, EHCI_LINK_TERMINATE); in ehci_setup_standard_chain()
1897 usb_pc_cpu_flush(td->page_cache); in ehci_setup_standard_chain()
1901 xfer->td_transfer_last = td; in ehci_setup_standard_chain()
1906 xfer->endpoint->toggle_next); in ehci_setup_standard_chain()
1908 xfer->td_transfer_first); in ehci_setup_standard_chain()
1912 methods = xfer->endpoint->methods; in ehci_setup_standard_chain()
1914 qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; in ehci_setup_standard_chain()
1919 (EHCI_QH_SET_ADDR(xfer->address) | in ehci_setup_standard_chain()
1920 EHCI_QH_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) | in ehci_setup_standard_chain()
1921 EHCI_QH_SET_MPL(xfer->max_packet_size)); in ehci_setup_standard_chain()
1923 if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) { in ehci_setup_standard_chain()
1928 if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) { in ehci_setup_standard_chain()
1948 qh->qh_endp = htohc32(temp.sc, qh_endp); in ehci_setup_standard_chain()
1951 (EHCI_QH_SET_MULT(xfer->max_packet_count & 3) | in ehci_setup_standard_chain()
1952 EHCI_QH_SET_CMASK(xfer->endpoint->usb_cmask) | in ehci_setup_standard_chain()
1953 EHCI_QH_SET_SMASK(xfer->endpoint->usb_smask) | in ehci_setup_standard_chain()
1954 EHCI_QH_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | in ehci_setup_standard_chain()
1955 EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no)); in ehci_setup_standard_chain()
1957 qh->qh_endphub = htohc32(temp.sc, qh_endphub); in ehci_setup_standard_chain()
1958 qh->qh_curqtd = 0; in ehci_setup_standard_chain()
1962 if (temp.auto_data_toggle && xfer->endpoint->toggle_next) { in ehci_setup_standard_chain()
1964 qh->qh_qtd.qtd_status = htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1)); in ehci_setup_standard_chain()
1966 qh->qh_qtd.qtd_status = 0; in ehci_setup_standard_chain()
1969 td = xfer->td_transfer_first; in ehci_setup_standard_chain()
1971 qh->qh_qtd.qtd_next = td->qtd_self; in ehci_setup_standard_chain()
1972 qh->qh_qtd.qtd_altnext = in ehci_setup_standard_chain()
1976 qh->qh_qtd.qtd_buffer[0] = 0; in ehci_setup_standard_chain()
1977 qh->qh_qtd.qtd_buffer[1] = 0; in ehci_setup_standard_chain()
1978 qh->qh_qtd.qtd_buffer[2] = 0; in ehci_setup_standard_chain()
1979 qh->qh_qtd.qtd_buffer[3] = 0; in ehci_setup_standard_chain()
1980 qh->qh_qtd.qtd_buffer[4] = 0; in ehci_setup_standard_chain()
1981 qh->qh_qtd.qtd_buffer_hi[0] = 0; in ehci_setup_standard_chain()
1982 qh->qh_qtd.qtd_buffer_hi[1] = 0; in ehci_setup_standard_chain()
1983 qh->qh_qtd.qtd_buffer_hi[2] = 0; in ehci_setup_standard_chain()
1984 qh->qh_qtd.qtd_buffer_hi[3] = 0; in ehci_setup_standard_chain()
1985 qh->qh_qtd.qtd_buffer_hi[4] = 0; in ehci_setup_standard_chain()
1987 usb_pc_cpu_flush(qh->page_cache); in ehci_setup_standard_chain()
1989 if (xfer->xroot->udev->flags.self_suspended == 0) { in ehci_setup_standard_chain()
2000 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in ehci_root_intr()
2003 memset(sc->sc_hub_idata, 0, sizeof(sc->sc_hub_idata)); in ehci_root_intr()
2006 m = (sc->sc_noport + 1); in ehci_root_intr()
2007 if (m > (8 * sizeof(sc->sc_hub_idata))) { in ehci_root_intr()
2008 m = (8 * sizeof(sc->sc_hub_idata)); in ehci_root_intr()
2013 sc->sc_hub_idata[i / 8] |= 1 << (i % 8); in ehci_root_intr()
2017 uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, in ehci_root_intr()
2018 sizeof(sc->sc_hub_idata)); in ehci_root_intr()
2024 uint32_t nframes = xfer->nframes; in ehci_isoc_fs_done()
2026 uint32_t *plen = xfer->frlengths; in ehci_isoc_fs_done()
2028 ehci_sitd_t *td = xfer->td_transfer_first; in ehci_isoc_fs_done()
2029 ehci_sitd_t **pp_last = &sc->sc_isoc_fs_p_last[xfer->qh_pos]; in ehci_isoc_fs_done()
2032 xfer, xfer->endpoint); in ehci_isoc_fs_done()
2034 while (nframes--) { in ehci_isoc_fs_done()
2039 if (pp_last >= &sc->sc_isoc_fs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) { in ehci_isoc_fs_done()
2040 pp_last = &sc->sc_isoc_fs_p_last[0]; in ehci_isoc_fs_done()
2044 DPRINTF("isoc FS-TD\n"); in ehci_isoc_fs_done()
2048 usb_pc_cpu_invalidate(td->page_cache); in ehci_isoc_fs_done()
2049 status = hc32toh(sc, td->sitd_status); in ehci_isoc_fs_done()
2056 len = *plen - len; in ehci_isoc_fs_done()
2063 /* remove FS-TD from schedule */ in ehci_isoc_fs_done()
2068 td = td->obj_next; in ehci_isoc_fs_done()
2071 xfer->aframes = xfer->nframes; in ehci_isoc_fs_done()
2077 uint32_t nframes = xfer->nframes; in ehci_isoc_hs_done()
2079 uint32_t *plen = xfer->frlengths; in ehci_isoc_hs_done()
2082 ehci_itd_t *td = xfer->td_transfer_first; in ehci_isoc_hs_done()
2083 ehci_itd_t **pp_last = &sc->sc_isoc_hs_p_last[xfer->qh_pos]; in ehci_isoc_hs_done()
2086 xfer, xfer->endpoint); in ehci_isoc_hs_done()
2093 if (pp_last >= &sc->sc_isoc_hs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) { in ehci_isoc_hs_done()
2094 pp_last = &sc->sc_isoc_hs_p_last[0]; in ehci_isoc_hs_done()
2098 DPRINTF("isoc HS-TD\n"); in ehci_isoc_hs_done()
2103 usb_pc_cpu_invalidate(td->page_cache); in ehci_isoc_hs_done()
2104 status = hc32toh(sc, td->itd_status[td_no]); in ehci_isoc_hs_done()
2110 if (xfer->endpoint->usb_smask & (1 << td_no)) { in ehci_isoc_hs_done()
2120 /* Invalid length - truncate */ in ehci_isoc_hs_done()
2126 nframes--; in ehci_isoc_hs_done()
2132 /* remove HS-TD from schedule */ in ehci_isoc_hs_done()
2137 td = td->obj_next; in ehci_isoc_hs_done()
2140 xfer->aframes = xfer->nframes; in ehci_isoc_hs_done()
2149 const struct usb_pipe_methods *methods = xfer->endpoint->methods; in ehci_device_done()
2150 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_done()
2152 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in ehci_device_done()
2155 xfer, xfer->endpoint, error); in ehci_device_done()
2162 xfer->endpoint->toggle_next); in ehci_device_done()
2164 xfer->td_transfer_first); in ehci_device_done()
2168 EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_done()
2169 sc->sc_async_p_last); in ehci_device_done()
2172 EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_done()
2173 sc->sc_intr_p_last[xfer->qh_pos]); in ehci_device_done()
2177 * "xfer->frlengths". in ehci_device_done()
2179 if (xfer->td_transfer_first && in ehci_device_done()
2180 xfer->td_transfer_last) { in ehci_device_done()
2187 xfer->td_transfer_first = NULL; in ehci_device_done()
2188 xfer->td_transfer_last = NULL; in ehci_device_done()
2194 /*------------------------------------------------------------------------*
2196 *------------------------------------------------------------------------*/
2235 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_bulk_start()
2238 ehci_setup_standard_chain(xfer, &sc->sc_async_p_last); in ehci_device_bulk_start()
2247 if (sc->sc_flags & EHCI_SCFLG_IAADBUG) in ehci_device_bulk_start()
2261 /*------------------------------------------------------------------------*
2263 *------------------------------------------------------------------------*/
2285 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_ctrl_start()
2288 ehci_setup_standard_chain(xfer, &sc->sc_async_p_last); in ehci_device_ctrl_start()
2302 /*------------------------------------------------------------------------*
2304 *------------------------------------------------------------------------*/
2308 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_intr_open()
2322 if (xfer->interval >= bit) { in ehci_device_intr_open()
2326 if (sc->sc_intr_stat[x] < in ehci_device_intr_open()
2327 sc->sc_intr_stat[best]) { in ehci_device_intr_open()
2337 sc->sc_intr_stat[best]++; in ehci_device_intr_open()
2338 xfer->qh_pos = best; in ehci_device_intr_open()
2341 best, xfer->interval); in ehci_device_intr_open()
2347 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_intr_close()
2349 sc->sc_intr_stat[xfer->qh_pos]--; in ehci_device_intr_close()
2366 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_intr_start()
2369 ehci_setup_standard_chain(xfer, &sc->sc_intr_p_last[xfer->qh_pos]); in ehci_device_intr_start()
2383 /*------------------------------------------------------------------------*
2385 *------------------------------------------------------------------------*/
2389 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_isoc_fs_open()
2395 EHCI_SITD_SET_ADDR(xfer->address) | in ehci_device_isoc_fs_open()
2396 EHCI_SITD_SET_ENDPT(UE_GET_ADDR(xfer->endpointno)) | in ehci_device_isoc_fs_open()
2397 EHCI_SITD_SET_HUBA(xfer->xroot->udev->hs_hub_addr) | in ehci_device_isoc_fs_open()
2398 EHCI_SITD_SET_PORT(xfer->xroot->udev->hs_port_no); in ehci_device_isoc_fs_open()
2400 if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) in ehci_device_isoc_fs_open()
2408 for (td = xfer->td_start[ds]; td; td = td->obj_next) { in ehci_device_isoc_fs_open()
2409 td->sitd_portaddr = sitd_portaddr; in ehci_device_isoc_fs_open()
2413 * SMASK/CMASK selection based on micro-frame in ehci_device_isoc_fs_open()
2416 * micro-frame usage (8 microframes per 1ms) in ehci_device_isoc_fs_open()
2418 td->sitd_back = htohc32(sc, EHCI_LINK_TERMINATE); in ehci_device_isoc_fs_open()
2420 usb_pc_cpu_flush(td->page_cache); in ehci_device_isoc_fs_open()
2435 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_isoc_fs_enter()
2455 xfer, xfer->endpoint->isoc_next, xfer->nframes); in ehci_device_isoc_fs_enter()
2462 xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) in ehci_device_isoc_fs_enter()
2467 nframes = xfer->nframes; in ehci_device_isoc_fs_enter()
2471 plen = xfer->frlengths; in ehci_device_isoc_fs_enter()
2474 xfer->flags_int.curr_dma_set ^= 1; in ehci_device_isoc_fs_enter()
2477 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in ehci_device_isoc_fs_enter()
2478 xfer->td_transfer_first = td; in ehci_device_isoc_fs_enter()
2480 pp_last = &sc->sc_isoc_fs_p_last[startframe]; in ehci_device_isoc_fs_enter()
2484 xfer->qh_pos = startframe; in ehci_device_isoc_fs_enter()
2486 while (nframes--) { in ehci_device_isoc_fs_enter()
2491 if (pp_last >= &sc->sc_isoc_fs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) in ehci_device_isoc_fs_enter()
2492 pp_last = &sc->sc_isoc_fs_p_last[0]; in ehci_device_isoc_fs_enter()
2496 if (*plen > xfer->max_frame_size) { in ehci_device_isoc_fs_enter()
2503 xfer->max_frame_size); in ehci_device_isoc_fs_enter()
2506 *plen = xfer->max_frame_size; in ehci_device_isoc_fs_enter()
2512 xfer->isoc_time_complete - nframes - 1); in ehci_device_isoc_fs_enter()
2520 sa = USB_FS_ISOC_UFRAME_MAX - 1; in ehci_device_isoc_fs_enter()
2525 * non-zero length in ehci_device_isoc_fs_enter()
2527 usbd_get_page(xfer->frbuffers, buf_offset, &buf_res); in ehci_device_isoc_fs_enter()
2528 td->sitd_bp[0] = htohc32(sc, buf_res.physaddr); in ehci_device_isoc_fs_enter()
2534 usbd_get_page(xfer->frbuffers, buf_offset - 1, in ehci_device_isoc_fs_enter()
2538 td->sitd_bp[0] = 0; in ehci_device_isoc_fs_enter()
2542 if (UE_GET_DIR(xfer->endpointno) == UE_DIR_OUT) { in ehci_device_isoc_fs_enter()
2545 temp |= 1; /* T-count = 1, TP = ALL */ in ehci_device_isoc_fs_enter()
2550 temp |= tlen; /* T-count = [1..6] */ in ehci_device_isoc_fs_enter()
2563 sa = (sb - sa) & 0x3F; in ehci_device_isoc_fs_enter()
2566 sb = (-(4 << sa)) & 0xFE; in ehci_device_isoc_fs_enter()
2573 td->sitd_bp[1] = htohc32(sc, temp); in ehci_device_isoc_fs_enter()
2575 td->sitd_mask = htohc32(sc, sitd_mask); in ehci_device_isoc_fs_enter()
2578 td->sitd_status = htohc32(sc, in ehci_device_isoc_fs_enter()
2583 td->sitd_status = htohc32(sc, in ehci_device_isoc_fs_enter()
2587 usb_pc_cpu_flush(td->page_cache); in ehci_device_isoc_fs_enter()
2591 DPRINTF("FS-TD %d\n", nframes); in ehci_device_isoc_fs_enter()
2601 td = td->obj_next; in ehci_device_isoc_fs_enter()
2604 xfer->td_transfer_last = td_last; in ehci_device_isoc_fs_enter()
2611 xfer->flags_int.can_cancel_immed = 0; in ehci_device_isoc_fs_enter()
2622 xfer->flags_int.can_cancel_immed = 0; in ehci_device_isoc_fs_start()
2625 if (xfer->timeout == 0) in ehci_device_isoc_fs_start()
2626 xfer->timeout = 500; /* ms */ in ehci_device_isoc_fs_start()
2640 /*------------------------------------------------------------------------*
2642 *------------------------------------------------------------------------*/
2646 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_isoc_hs_open()
2656 for (td = xfer->td_start[ds]; td; td = td->obj_next) { in ehci_device_isoc_hs_open()
2658 td->itd_status[0] = 0; in ehci_device_isoc_hs_open()
2659 td->itd_status[1] = 0; in ehci_device_isoc_hs_open()
2660 td->itd_status[2] = 0; in ehci_device_isoc_hs_open()
2661 td->itd_status[3] = 0; in ehci_device_isoc_hs_open()
2662 td->itd_status[4] = 0; in ehci_device_isoc_hs_open()
2663 td->itd_status[5] = 0; in ehci_device_isoc_hs_open()
2664 td->itd_status[6] = 0; in ehci_device_isoc_hs_open()
2665 td->itd_status[7] = 0; in ehci_device_isoc_hs_open()
2668 td->itd_bp[0] = htohc32(sc, in ehci_device_isoc_hs_open()
2669 EHCI_ITD_SET_ADDR(xfer->address) | in ehci_device_isoc_hs_open()
2670 EHCI_ITD_SET_ENDPT(UE_GET_ADDR(xfer->endpointno))); in ehci_device_isoc_hs_open()
2673 EHCI_ITD_SET_MPL(xfer->max_packet_size & 0x7FF); in ehci_device_isoc_hs_open()
2676 if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) { in ehci_device_isoc_hs_open()
2680 td->itd_bp[1] = htohc32(sc, temp); in ehci_device_isoc_hs_open()
2683 td->itd_bp[2] = htohc32(sc, xfer->max_packet_count & 3); in ehci_device_isoc_hs_open()
2685 usb_pc_cpu_flush(td->page_cache); in ehci_device_isoc_hs_open()
2703 ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_device_isoc_hs_enter()
2724 xfer, xfer->endpoint->isoc_next, xfer->nframes, in ehci_device_isoc_hs_enter()
2732 xfer, nframes, 0, 1, EHCI_VIRTUAL_FRAMELIST_COUNT - 1, &startframe)) in ehci_device_isoc_hs_enter()
2735 nframes = xfer->nframes; in ehci_device_isoc_hs_enter()
2740 plen = xfer->frlengths; in ehci_device_isoc_hs_enter()
2743 xfer->flags_int.curr_dma_set ^= 1; in ehci_device_isoc_hs_enter()
2746 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in ehci_device_isoc_hs_enter()
2747 xfer->td_transfer_first = td; in ehci_device_isoc_hs_enter()
2749 pp_last = &sc->sc_isoc_hs_p_last[startframe]; in ehci_device_isoc_hs_enter()
2753 xfer->qh_pos = startframe; in ehci_device_isoc_hs_enter()
2760 if (pp_last >= &sc->sc_isoc_hs_p_last[EHCI_VIRTUAL_FRAMELIST_COUNT]) { in ehci_device_isoc_hs_enter()
2761 pp_last = &sc->sc_isoc_hs_p_last[0]; in ehci_device_isoc_hs_enter()
2764 if (*plen > xfer->max_frame_size) { in ehci_device_isoc_hs_enter()
2770 __FUNCTION__, *plen, xfer->max_frame_size); in ehci_device_isoc_hs_enter()
2773 *plen = xfer->max_frame_size; in ehci_device_isoc_hs_enter()
2776 if (xfer->endpoint->usb_smask & (1 << td_no)) { in ehci_device_isoc_hs_enter()
2780 td->itd_status[td_no] = htohc32(sc, status); in ehci_device_isoc_hs_enter()
2784 nframes --; in ehci_device_isoc_hs_enter()
2786 td->itd_status[td_no] = 0; /* not active */ in ehci_device_isoc_hs_enter()
2795 td->itd_status[x] = 0; /* not active */ in ehci_device_isoc_hs_enter()
2804 usbd_get_page(xfer->frbuffers, itd_offset[0], &buf_res); in ehci_device_isoc_hs_enter()
2808 td->itd_bp[0] &= htohc32(sc, 0xFFF); in ehci_device_isoc_hs_enter()
2809 td->itd_bp[0] |= htohc32(sc, page_addr); in ehci_device_isoc_hs_enter()
2815 td->itd_status[x] |= htohc32(sc, status); in ehci_device_isoc_hs_enter()
2824 usbd_get_page(xfer->frbuffers, buf_offset - 1, &buf_res); in ehci_device_isoc_hs_enter()
2826 usbd_get_page(xfer->frbuffers, itd_offset[x + 1], &buf_res); in ehci_device_isoc_hs_enter()
2838 td->itd_bp[page_no] &= htohc32(sc, 0xFFF); in ehci_device_isoc_hs_enter()
2839 td->itd_bp[page_no] |= htohc32(sc, page_addr); in ehci_device_isoc_hs_enter()
2845 td->itd_status[td_no - 1] |= htohc32(sc, EHCI_ITD_IOC); in ehci_device_isoc_hs_enter()
2847 usb_pc_cpu_flush(td->page_cache); in ehci_device_isoc_hs_enter()
2850 DPRINTF("HS-TD %d\n", nframes); in ehci_device_isoc_hs_enter()
2860 td = td->obj_next; in ehci_device_isoc_hs_enter()
2864 xfer->td_transfer_last = td_last; in ehci_device_isoc_hs_enter()
2882 /*------------------------------------------------------------------------*
2884 *------------------------------------------------------------------------*
2886 *------------------------------------------------------------------------*/
3000 ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); in ehci_roothub_exec()
3011 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in ehci_roothub_exec()
3014 ptr = (const void *)&sc->sc_hub_desc; in ehci_roothub_exec()
3018 value = UGETW(req->wValue); in ehci_roothub_exec()
3019 index = UGETW(req->wIndex); in ehci_roothub_exec()
3023 req->bmRequestType, req->bRequest, in ehci_roothub_exec()
3024 UGETW(req->wLength), value, index); in ehci_roothub_exec()
3027 switch (C(req->bRequest, req->bmRequestType)) { in ehci_roothub_exec()
3032 * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops in ehci_roothub_exec()
3038 sc->sc_hub_desc.temp[0] = sc->sc_conf; in ehci_roothub_exec()
3080 str_ptr = sc->sc_vendor; in ehci_roothub_exec()
3093 sc->sc_hub_desc.temp, in ehci_roothub_exec()
3094 sizeof(sc->sc_hub_desc.temp), in ehci_roothub_exec()
3104 sc->sc_hub_desc.temp[0] = 0; in ehci_roothub_exec()
3108 USETW(sc->sc_hub_desc.stat.wStatus, UDS_SELF_POWERED); in ehci_roothub_exec()
3113 USETW(sc->sc_hub_desc.stat.wStatus, 0); in ehci_roothub_exec()
3120 sc->sc_addr = value; in ehci_roothub_exec()
3127 sc->sc_conf = value; in ehci_roothub_exec()
3147 (index > sc->sc_noport)) { in ehci_roothub_exec()
3166 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50); in ehci_roothub_exec()
3172 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 250); in ehci_roothub_exec()
3199 sc->sc_isreset = 0; in ehci_roothub_exec()
3213 sc->sc_hub_desc.hubd = ehci_hubd; in ehci_roothub_exec()
3214 sc->sc_hub_desc.hubd.bNbrPorts = sc->sc_noport; in ehci_roothub_exec()
3224 USETW(sc->sc_hub_desc.hubd.wHubCharacteristics, i); in ehci_roothub_exec()
3226 sc->sc_hub_desc.hubd.bPwrOn2PwrGood = 200; in ehci_roothub_exec()
3228 sc->sc_hub_desc.hubd.bDescLength = in ehci_roothub_exec()
3229 8 + ((sc->sc_noport + 7) / 8); in ehci_roothub_exec()
3230 len = sc->sc_hub_desc.hubd.bDescLength; in ehci_roothub_exec()
3234 memset(sc->sc_hub_desc.temp, 0, 16); in ehci_roothub_exec()
3240 (index > sc->sc_noport)) { in ehci_roothub_exec()
3246 if (sc->sc_flags & EHCI_SCFLG_TT) { in ehci_roothub_exec()
3247 if (sc->sc_vendor_get_port_speed != NULL) { in ehci_roothub_exec()
3248 i = sc->sc_vendor_get_port_speed(sc, index); in ehci_roothub_exec()
3250 device_printf(sc->sc_bus.bdev, in ehci_roothub_exec()
3270 USETW(sc->sc_hub_desc.ps.wPortStatus, i); in ehci_roothub_exec()
3280 if (sc->sc_isreset) in ehci_roothub_exec()
3282 USETW(sc->sc_hub_desc.ps.wPortChange, i); in ehci_roothub_exec()
3283 len = sizeof(sc->sc_hub_desc.ps); in ehci_roothub_exec()
3292 (index > sc->sc_noport)) { in ehci_roothub_exec()
3318 (sc->sc_flags & EHCI_SCFLG_TT) == 0) { in ehci_roothub_exec()
3328 usb_pause_mtx(&sc->sc_bus.bus_mtx, in ehci_roothub_exec()
3332 if (!(sc->sc_flags & EHCI_SCFLG_NORESTERM)) in ehci_roothub_exec()
3336 usb_pause_mtx(&sc->sc_bus.bus_mtx, in ehci_roothub_exec()
3342 device_printf(sc->sc_bus.bdev, in ehci_roothub_exec()
3348 (sc->sc_flags & EHCI_SCFLG_TT) == 0) { in ehci_roothub_exec()
3353 sc->sc_isreset = 1; in ehci_roothub_exec()
3406 sc = EHCI_BUS2SC(parm->udev->bus); in ehci_xfer_setup()
3407 xfer = parm->curr_xfer; in ehci_xfer_setup()
3417 if (parm->methods == &ehci_device_ctrl_methods) { in ehci_xfer_setup()
3422 * +------------------------------------+ in ehci_xfer_setup()
3424 * | |remainder -> | in ehci_xfer_setup()
3425 * | +-----+---+ | in ehci_xfer_setup()
3427 * | +-----+---++ | in ehci_xfer_setup()
3429 * | +-----+----+ | in ehci_xfer_setup()
3431 * +------------------------------------+ in ehci_xfer_setup()
3447 parm->hc_max_packet_size = 0x400; in ehci_xfer_setup()
3448 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3449 parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX; in ehci_xfer_setup()
3450 xfer->flags_int.bdma_enable = 1; in ehci_xfer_setup()
3455 nqtd = ((2 * xfer->nframes) + 1 /* STATUS */ in ehci_xfer_setup()
3456 + (xfer->max_data_length / xfer->max_hc_frame_size)); in ehci_xfer_setup()
3458 } else if (parm->methods == &ehci_device_bulk_methods) { in ehci_xfer_setup()
3459 parm->hc_max_packet_size = 0x400; in ehci_xfer_setup()
3460 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3461 parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX; in ehci_xfer_setup()
3462 xfer->flags_int.bdma_enable = 1; in ehci_xfer_setup()
3467 nqtd = ((2 * xfer->nframes) in ehci_xfer_setup()
3468 + (xfer->max_data_length / xfer->max_hc_frame_size)); in ehci_xfer_setup()
3470 } else if (parm->methods == &ehci_device_intr_methods) { in ehci_xfer_setup()
3471 if (parm->speed == USB_SPEED_HIGH) { in ehci_xfer_setup()
3472 parm->hc_max_packet_size = 0x400; in ehci_xfer_setup()
3473 parm->hc_max_packet_count = 3; in ehci_xfer_setup()
3474 } else if (parm->speed == USB_SPEED_FULL) { in ehci_xfer_setup()
3475 parm->hc_max_packet_size = USB_FS_BYTES_PER_HS_UFRAME; in ehci_xfer_setup()
3476 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3478 parm->hc_max_packet_size = USB_FS_BYTES_PER_HS_UFRAME / 8; in ehci_xfer_setup()
3479 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3482 parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX; in ehci_xfer_setup()
3483 xfer->flags_int.bdma_enable = 1; in ehci_xfer_setup()
3488 nqtd = ((2 * xfer->nframes) in ehci_xfer_setup()
3489 + (xfer->max_data_length / xfer->max_hc_frame_size)); in ehci_xfer_setup()
3491 } else if (parm->methods == &ehci_device_isoc_fs_methods) { in ehci_xfer_setup()
3492 parm->hc_max_packet_size = 0x3FF; in ehci_xfer_setup()
3493 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3494 parm->hc_max_frame_size = 0x3FF; in ehci_xfer_setup()
3495 xfer->flags_int.bdma_enable = 1; in ehci_xfer_setup()
3499 nsitd = xfer->nframes; in ehci_xfer_setup()
3501 } else if (parm->methods == &ehci_device_isoc_hs_methods) { in ehci_xfer_setup()
3502 parm->hc_max_packet_size = 0x400; in ehci_xfer_setup()
3503 parm->hc_max_packet_count = 3; in ehci_xfer_setup()
3504 parm->hc_max_frame_size = 0xC00; in ehci_xfer_setup()
3505 xfer->flags_int.bdma_enable = 1; in ehci_xfer_setup()
3509 nitd = ((xfer->nframes + 7) / 8) << in ehci_xfer_setup()
3513 parm->hc_max_packet_size = 0x400; in ehci_xfer_setup()
3514 parm->hc_max_packet_count = 1; in ehci_xfer_setup()
3515 parm->hc_max_frame_size = 0x400; in ehci_xfer_setup()
3522 if (parm->err) { in ehci_xfer_setup()
3533 parm->err = USB_ERR_NOMEM; in ehci_xfer_setup()
3536 if (parm->buf) { in ehci_xfer_setup()
3545 td->itd_self = htohc32(sc, page_info.physaddr | EHCI_LINK_ITD); in ehci_xfer_setup()
3546 td->obj_next = last_obj; in ehci_xfer_setup()
3547 td->page_cache = pc + n; in ehci_xfer_setup()
3557 parm->err = USB_ERR_NOMEM; in ehci_xfer_setup()
3560 if (parm->buf) { in ehci_xfer_setup()
3569 td->sitd_self = htohc32(sc, page_info.physaddr | EHCI_LINK_SITD); in ehci_xfer_setup()
3570 td->obj_next = last_obj; in ehci_xfer_setup()
3571 td->page_cache = pc + n; in ehci_xfer_setup()
3581 parm->err = USB_ERR_NOMEM; in ehci_xfer_setup()
3584 if (parm->buf) { in ehci_xfer_setup()
3593 qtd->qtd_self = htohc32(sc, page_info.physaddr); in ehci_xfer_setup()
3594 qtd->obj_next = last_obj; in ehci_xfer_setup()
3595 qtd->page_cache = pc + n; in ehci_xfer_setup()
3602 xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; in ehci_xfer_setup()
3609 parm->err = USB_ERR_NOMEM; in ehci_xfer_setup()
3612 if (parm->buf) { in ehci_xfer_setup()
3621 qh->qh_self = htohc32(sc, page_info.physaddr | EHCI_LINK_QH); in ehci_xfer_setup()
3622 qh->obj_next = last_obj; in ehci_xfer_setup()
3623 qh->page_cache = pc + n; in ehci_xfer_setup()
3630 xfer->qh_start[xfer->flags_int.curr_dma_set] = last_obj; in ehci_xfer_setup()
3632 if (!xfer->flags_int.curr_dma_set) { in ehci_xfer_setup()
3633 xfer->flags_int.curr_dma_set = 1; in ehci_xfer_setup()
3648 ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); in ehci_ep_init()
3650 DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d (%d)\n", in ehci_ep_init()
3651 ep, udev->address, in ehci_ep_init()
3652 edesc->bEndpointAddress, udev->flags.usb_mode, in ehci_ep_init()
3653 sc->sc_addr); in ehci_ep_init()
3655 if (udev->device_index != sc->sc_addr) { in ehci_ep_init()
3656 if ((udev->speed != USB_SPEED_HIGH) && in ehci_ep_init()
3657 ((udev->hs_hub_addr == 0) || in ehci_ep_init()
3658 (udev->hs_port_no == 0) || in ehci_ep_init()
3659 (udev->parent_hs_hub == NULL) || in ehci_ep_init()
3660 (udev->parent_hs_hub->hub == NULL))) { in ehci_ep_init()
3664 switch (edesc->bmAttributes & UE_XFERTYPE) { in ehci_ep_init()
3666 ep->methods = &ehci_device_ctrl_methods; in ehci_ep_init()
3669 ep->methods = &ehci_device_intr_methods; in ehci_ep_init()
3672 if (udev->speed == USB_SPEED_HIGH) { in ehci_ep_init()
3673 ep->methods = &ehci_device_isoc_hs_methods; in ehci_ep_init()
3674 } else if (udev->speed == USB_SPEED_FULL) { in ehci_ep_init()
3675 ep->methods = &ehci_device_isoc_fs_methods; in ehci_ep_init()
3679 ep->methods = &ehci_device_bulk_methods; in ehci_ep_init()
3703 ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); in ehci_device_resume()
3709 USB_BUS_LOCK(udev->bus); in ehci_device_resume()
3711 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in ehci_device_resume()
3712 if (xfer->xroot->udev == udev) { in ehci_device_resume()
3713 methods = xfer->endpoint->methods; in ehci_device_resume()
3717 EHCI_APPEND_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_resume()
3718 sc->sc_async_p_last); in ehci_device_resume()
3721 EHCI_APPEND_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_resume()
3722 sc->sc_intr_p_last[xfer->qh_pos]); in ehci_device_resume()
3727 USB_BUS_UNLOCK(udev->bus); in ehci_device_resume()
3735 ehci_softc_t *sc = EHCI_BUS2SC(udev->bus); in ehci_device_suspend()
3741 USB_BUS_LOCK(udev->bus); in ehci_device_suspend()
3743 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in ehci_device_suspend()
3744 if (xfer->xroot->udev == udev) { in ehci_device_suspend()
3745 methods = xfer->endpoint->methods; in ehci_device_suspend()
3749 EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_suspend()
3750 sc->sc_async_p_last); in ehci_device_suspend()
3753 EHCI_REMOVE_QH(xfer->qh_start[xfer->flags_int.curr_dma_set], in ehci_device_suspend()
3754 sc->sc_intr_p_last[xfer->qh_pos]); in ehci_device_suspend()
3759 USB_BUS_UNLOCK(udev->bus); in ehci_device_suspend()
3791 flags = bus->hw_power_state; in ehci_set_hw_power()
3817 struct ehci_softc *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_start_dma_delay_second()
3837 struct ehci_softc *sc = EHCI_BUS2SC(xfer->xroot->bus); in ehci_start_dma_delay()