Lines Matching +full:has +full:- +full:transaction +full:- +full:translator
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2010-2022 Hans Petter Selasky
91 ((sc)->sc_ctx_is_64_byte ? \
92 &((struct which##64 *)(ptr))->field.ctx : \
93 &((struct which *)(ptr))->field)
124 &xhcidma32, 0, "Set to only use 32-bit DMA for the XHCI controller");
182 DPRINTFN(5, "qwTrb0 = 0x%016llx\n", (long long)le64toh(trb->qwTrb0)); in xhci_dump_trb()
183 DPRINTFN(5, "dwTrb2 = 0x%08x\n", le32toh(trb->dwTrb2)); in xhci_dump_trb()
184 DPRINTFN(5, "dwTrb3 = 0x%08x\n", le32toh(trb->dwTrb3)); in xhci_dump_trb()
191 DPRINTFN(5, "dwEpCtx0=0x%08x\n", le32toh(pep->dwEpCtx0)); in xhci_dump_endpoint()
192 DPRINTFN(5, "dwEpCtx1=0x%08x\n", le32toh(pep->dwEpCtx1)); in xhci_dump_endpoint()
193 DPRINTFN(5, "qwEpCtx2=0x%016llx\n", (long long)le64toh(pep->qwEpCtx2)); in xhci_dump_endpoint()
194 DPRINTFN(5, "dwEpCtx4=0x%08x\n", le32toh(pep->dwEpCtx4)); in xhci_dump_endpoint()
195 DPRINTFN(5, "dwEpCtx5=0x%08x\n", le32toh(pep->dwEpCtx5)); in xhci_dump_endpoint()
196 DPRINTFN(5, "dwEpCtx6=0x%08x\n", le32toh(pep->dwEpCtx6)); in xhci_dump_endpoint()
197 DPRINTFN(5, "dwEpCtx7=0x%08x\n", le32toh(pep->dwEpCtx7)); in xhci_dump_endpoint()
204 DPRINTFN(5, "dwSctx0=0x%08x\n", le32toh(psl->dwSctx0)); in xhci_dump_device()
205 DPRINTFN(5, "dwSctx1=0x%08x\n", le32toh(psl->dwSctx1)); in xhci_dump_device()
206 DPRINTFN(5, "dwSctx2=0x%08x\n", le32toh(psl->dwSctx2)); in xhci_dump_device()
207 DPRINTFN(5, "dwSctx3=0x%08x\n", le32toh(psl->dwSctx3)); in xhci_dump_device()
227 cb(bus, &sc->sc_hw.root_pc, &sc->sc_hw.root_pg, in xhci_iterate_hw_softc()
230 cb(bus, &sc->sc_hw.ctx_pc, &sc->sc_hw.ctx_pg, in xhci_iterate_hw_softc()
233 for (i = 0; i != sc->sc_noscratch; i++) { in xhci_iterate_hw_softc()
234 cb(bus, &sc->sc_hw.scratch_pc[i], &sc->sc_hw.scratch_pg[i], in xhci_iterate_hw_softc()
268 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 4); in xhci_reset_command_queue_locked()
279 sc->sc_command_ccs = 1; in xhci_reset_command_queue_locked()
280 sc->sc_command_idx = 0; in xhci_reset_command_queue_locked()
282 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_reset_command_queue_locked()
291 memset(phwr->hwr_commands, 0, sizeof(phwr->hwr_commands)); in xhci_reset_command_queue_locked()
292 phwr->hwr_commands[XHCI_MAX_COMMANDS - 1].qwTrb0 = htole64(addr); in xhci_reset_command_queue_locked()
294 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_reset_command_queue_locked()
315 sc->sc_event_ccs = 1; in xhci_start_controller()
316 sc->sc_event_idx = 0; in xhci_start_controller()
317 sc->sc_command_ccs = 1; in xhci_start_controller()
318 sc->sc_command_idx = 0; in xhci_start_controller()
325 DPRINTF("CONFIG=0x%08x -> 0x%08x\n", in xhci_start_controller()
326 XREAD4(sc, oper, XHCI_CONFIG), sc->sc_noslot); in xhci_start_controller()
328 XWRITE4(sc, oper, XHCI_CONFIG, sc->sc_noslot); in xhci_start_controller()
338 usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res); in xhci_start_controller()
346 pdctxa->qwBaaDevCtxAddr[0] = htole64(addr); in xhci_start_controller()
348 for (i = 0; i != sc->sc_noscratch; i++) { in xhci_start_controller()
350 usbd_get_page(&sc->sc_hw.scratch_pc[i], 0, &buf_scp); in xhci_start_controller()
351 pdctxa->qwSpBufPtr[i] = htole64((uint64_t)buf_scp.physaddr); in xhci_start_controller()
362 DPRINTF("ERSTSZ=0x%08x -> 0x%08x\n", in xhci_start_controller()
363 XREAD4(sc, runt, XHCI_ERSTSZ(0)), sc->sc_erst_max); in xhci_start_controller()
365 XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(sc->sc_erst_max)); in xhci_start_controller()
368 XWRITE4(sc, runt, XHCI_IMOD(0), sc->sc_imod_default); in xhci_start_controller()
370 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_start_controller()
379 phwr->hwr_ring_seg[0].qwEvrsTablePtr = htole64(addr); in xhci_start_controller()
380 phwr->hwr_ring_seg[0].dwEvrsTableSize = htole32(XHCI_MAX_EVENTS); in xhci_start_controller()
393 usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_start_controller()
421 phwr->hwr_commands[XHCI_MAX_COMMANDS - 1].qwTrb0 = htole64(addr); in xhci_start_controller()
423 usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_start_controller()
437 device_printf(sc->sc_bus.parent, "Run timeout.\n"); in xhci_start_controller()
442 xhci_do_poll(&sc->sc_bus); in xhci_start_controller()
444 if (sc->sc_port_route != NULL) { in xhci_start_controller()
446 sc->sc_port_route(sc->sc_bus.parent, in xhci_start_controller()
460 sc->sc_capa_off = 0; in xhci_halt_controller()
461 sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); in xhci_halt_controller()
462 sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0xF; in xhci_halt_controller()
463 sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; in xhci_halt_controller()
476 device_printf(sc->sc_bus.parent, "Controller halt timeout.\n"); in xhci_halt_controller()
502 device_printf(sc->sc_bus.parent, "Controller " in xhci_reset_controller()
517 sc->sc_bus.parent = self; in xhci_init()
520 sc->sc_bus.usbrev = USB_REV_3_0; in xhci_init()
523 sc->sc_bus.methods = &xhci_bus_methods; in xhci_init()
526 sc->sc_bus.devices = sc->sc_devices; in xhci_init()
527 sc->sc_bus.devices_max = XHCI_MAX_DEVICES; in xhci_init()
530 sc->sc_event_ccs = 1; in xhci_init()
531 sc->sc_command_ccs = 1; in xhci_init()
534 sc->sc_capa_off = 0; in xhci_init()
535 sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); in xhci_init()
536 sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0x1F; in xhci_init()
537 sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; in xhci_init()
539 DPRINTF("CAPLENGTH=0x%x\n", sc->sc_oper_off); in xhci_init()
540 DPRINTF("RUNTIMEOFFSET=0x%x\n", sc->sc_runt_off); in xhci_init()
541 DPRINTF("DOOROFFSET=0x%x\n", sc->sc_door_off); in xhci_init()
546 device_printf(sc->sc_bus.parent, "Controller does " in xhci_init()
557 sc->sc_ctx_is_64_byte = 1; in xhci_init()
559 sc->sc_ctx_is_64_byte = 0; in xhci_init()
563 sc->sc_bus.dma_bits = (XHCI_HCS0_AC64(temp) && in xhci_init()
566 device_printf(self, "%d bytes context size, %d-bit DMA\n", in xhci_init()
567 sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); in xhci_init()
570 sc->sc_bus.control_ep_quirk = (xhcictlquirk ? 1 : 0); in xhci_init()
575 sc->sc_noport = XHCI_HCS1_N_PORTS(temp); in xhci_init()
577 if (sc->sc_noport == 0) { in xhci_init()
578 device_printf(sc->sc_bus.parent, "Invalid number " in xhci_init()
579 "of ports: %u\n", sc->sc_noport); in xhci_init()
583 sc->sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp); in xhci_init()
585 DPRINTF("Max slots: %u\n", sc->sc_noslot); in xhci_init()
587 if (sc->sc_noslot > XHCI_MAX_DEVICES) in xhci_init()
588 sc->sc_noslot = XHCI_MAX_DEVICES; in xhci_init()
595 sc->sc_ist = XHCI_HCS2_IST(temp); in xhci_init()
598 sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); in xhci_init()
600 if (sc->sc_noscratch > XHCI_MAX_SCRATCHPADS) { in xhci_init()
601 device_printf(sc->sc_bus.parent, "XHCI request " in xhci_init()
606 DPRINTF("Max scratch: %u\n", sc->sc_noscratch); in xhci_init()
609 sc->sc_erst_max = 1U << XHCI_HCS2_ERST_MAX(temp); in xhci_init()
610 if (sc->sc_erst_max > XHCI_MAX_RSEG) in xhci_init()
611 sc->sc_erst_max = XHCI_MAX_RSEG; in xhci_init()
616 sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + in xhci_init()
620 if (sc->sc_imod_default == 0) in xhci_init()
621 sc->sc_imod_default = XHCI_IMOD_DEFAULT; in xhci_init()
624 if (usb_bus_mem_alloc_all(&sc->sc_bus, in xhci_init()
630 cv_init(&sc->sc_cmd_cv, "CMDQ"); in xhci_init()
631 sx_init(&sc->sc_cmd_sx, "CMDQ lock"); in xhci_init()
633 sc->sc_config_msg[0].hdr.pm_callback = &xhci_configure_msg; in xhci_init()
634 sc->sc_config_msg[0].bus = &sc->sc_bus; in xhci_init()
635 sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg; in xhci_init()
636 sc->sc_config_msg[1].bus = &sc->sc_bus; in xhci_init()
650 usb_bus_mem_free_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_uninit()
652 cv_destroy(&sc->sc_cmd_cv); in xhci_uninit()
653 sx_destroy(&sc->sc_cmd_sx); in xhci_uninit()
689 td = xfer->td_transfer_cache; in xhci_generic_done_sub()
690 td_alt_next = td->alt_next; in xhci_generic_done_sub()
692 if (xfer->aframes != xfer->nframes) in xhci_generic_done_sub()
693 usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); in xhci_generic_done_sub()
696 usb_pc_cpu_invalidate(td->page_cache); in xhci_generic_done_sub()
698 status = td->status; in xhci_generic_done_sub()
699 len = td->remainder; in xhci_generic_done_sub()
702 xfer, (unsigned)xfer->aframes, in xhci_generic_done_sub()
703 (unsigned)xfer->nframes, in xhci_generic_done_sub()
704 (unsigned)len, (unsigned)td->len, in xhci_generic_done_sub()
711 if (len > td->len) { in xhci_generic_done_sub()
714 "0x%04x/0x%04x bytes\n", len, td->len); in xhci_generic_done_sub()
716 } else if (xfer->aframes != xfer->nframes) { in xhci_generic_done_sub()
717 xfer->frlengths[xfer->aframes] += td->len - len; in xhci_generic_done_sub()
720 if (((void *)td) == xfer->td_transfer_last) { in xhci_generic_done_sub()
733 if (xfer->flags_int.short_frames_ok || in xhci_generic_done_sub()
734 xfer->flags_int.isochronous_xfr || in xhci_generic_done_sub()
735 xfer->flags_int.control_xfr) { in xhci_generic_done_sub()
737 td = td->alt_next; in xhci_generic_done_sub()
744 td = td->obj_next; in xhci_generic_done_sub()
746 if (td->alt_next != td_alt_next) { in xhci_generic_done_sub()
754 xfer->td_transfer_cache = td; in xhci_generic_done_sub()
768 xfer, xfer->endpoint); in xhci_generic_done()
772 xfer->td_transfer_cache = xfer->td_transfer_first; in xhci_generic_done()
774 if (xfer->flags_int.control_xfr) { in xhci_generic_done()
775 if (xfer->flags_int.control_hdr) in xhci_generic_done()
778 xfer->aframes = 1; in xhci_generic_done()
780 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
784 while (xfer->aframes != xfer->nframes) { in xhci_generic_done()
786 xfer->aframes++; in xhci_generic_done()
788 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
792 if (xfer->flags_int.control_xfr && in xhci_generic_done()
793 !xfer->flags_int.control_act) in xhci_generic_done()
805 td = xfer->td_transfer_cache; in xhci_activate_transfer()
807 usb_pc_cpu_invalidate(td->page_cache); in xhci_activate_transfer()
809 if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { in xhci_activate_transfer()
812 td->td_trb[0].dwTrb3 |= htole32(XHCI_TRB_3_CYCLE_BIT); in xhci_activate_transfer()
813 usb_pc_cpu_flush(td->page_cache); in xhci_activate_transfer()
825 td = xfer->td_transfer_cache; in xhci_skip_transfer()
826 td_last = xfer->td_transfer_last; in xhci_skip_transfer()
828 td = td->alt_next; in xhci_skip_transfer()
830 usb_pc_cpu_invalidate(td->page_cache); in xhci_skip_transfer()
832 if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { in xhci_skip_transfer()
833 usb_pc_cpu_invalidate(td_last->page_cache); in xhci_skip_transfer()
837 td->td_trb[0].qwTrb0 = td_last->td_trb[td_last->ntrb].qwTrb0; in xhci_skip_transfer()
838 td->td_trb[0].dwTrb2 = td_last->td_trb[td_last->ntrb].dwTrb2; in xhci_skip_transfer()
839 usb_pc_cpu_flush(td->page_cache); in xhci_skip_transfer()
841 td->td_trb[0].dwTrb3 = td_last->td_trb[td_last->ntrb].dwTrb3; in xhci_skip_transfer()
842 usb_pc_cpu_flush(td->page_cache); in xhci_skip_transfer()
848 /*------------------------------------------------------------------------*
850 *------------------------------------------------------------------------*/
867 td_event = le64toh(trb->qwTrb0); in xhci_check_transfer()
868 temp = le32toh(trb->dwTrb2); in xhci_check_transfer()
873 temp = le32toh(trb->dwTrb3); in xhci_check_transfer()
884 if (index > sc->sc_noslot) { in xhci_check_transfer()
894 pepext = &sc->sc_hw.devs[index].endp[epno]; in xhci_check_transfer()
901 if (i == (XHCI_MAX_TRANSFERS - 1)) { in xhci_check_transfer()
902 if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS || in xhci_check_transfer()
903 stream_id == (XHCI_MAX_STREAMS - 1)) in xhci_check_transfer()
910 xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; in xhci_check_transfer()
914 td = xfer->td_transfer_cache; in xhci_check_transfer()
918 (long long)td->td_self, in xhci_check_transfer()
919 (long long)td->td_self + sizeof(td->td_trb)); in xhci_check_transfer()
931 offset = td_event - td->td_self; in xhci_check_transfer()
934 offset < (int64_t)sizeof(td->td_trb)) { in xhci_check_transfer()
935 usb_pc_cpu_invalidate(td->page_cache); in xhci_check_transfer()
938 for (i = (offset / 16) + 1; i < td->ntrb; i++) { in xhci_check_transfer()
939 temp = le32toh(td->td_trb[i].dwTrb2); in xhci_check_transfer()
946 if (xfer->flags_int.isochronous_xfr) { in xhci_check_transfer()
950 remainder = td->len; in xhci_check_transfer()
954 /* "td->remainder" is verified later */ in xhci_check_transfer()
955 td->remainder = remainder; in xhci_check_transfer()
956 td->status = status; in xhci_check_transfer()
958 usb_pc_cpu_flush(td->page_cache); in xhci_check_transfer()
964 if (((void *)td) == xfer->td_transfer_last) { in xhci_check_transfer()
975 DPRINTF("TD has I/O error\n"); in xhci_check_transfer()
984 if (td->remainder > 0) { in xhci_check_transfer()
985 if (td->alt_next == NULL) { in xhci_check_transfer()
987 "short TD has no alternate next\n"); in xhci_check_transfer()
991 DPRINTF("TD has short pkt\n"); in xhci_check_transfer()
992 if (xfer->flags_int.short_frames_ok || in xhci_check_transfer()
993 xfer->flags_int.isochronous_xfr || in xhci_check_transfer()
994 xfer->flags_int.control_xfr) { in xhci_check_transfer()
996 xfer->td_transfer_cache = td->alt_next; in xhci_check_transfer()
1006 * 4) Transfer complete - go to next TD in xhci_check_transfer()
1009 xfer->td_transfer_cache = td->obj_next; in xhci_check_transfer()
1019 if (sc->sc_cmd_addr == trb->qwTrb0) { in xhci_check_command()
1021 sc->sc_cmd_result[0] = trb->dwTrb2; in xhci_check_command()
1022 sc->sc_cmd_result[1] = trb->dwTrb3; in xhci_check_command()
1023 cv_signal(&sc->sc_cmd_cv); in xhci_check_command()
1043 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_interrupt_poll()
1049 usb_pc_cpu_invalidate(&sc->sc_hw.root_pc); in xhci_interrupt_poll()
1051 i = sc->sc_event_idx; in xhci_interrupt_poll()
1052 j = sc->sc_event_ccs; in xhci_interrupt_poll()
1056 temp = le32toh(phwr->hwr_events[i].dwTrb3); in xhci_interrupt_poll()
1066 i, event, (long long)le64toh(phwr->hwr_events[i].qwTrb0), in xhci_interrupt_poll()
1067 (long)le32toh(phwr->hwr_events[i].dwTrb2), in xhci_interrupt_poll()
1068 (long)le32toh(phwr->hwr_events[i].dwTrb3)); in xhci_interrupt_poll()
1072 xhci_check_transfer(sc, &phwr->hwr_events[i]); in xhci_interrupt_poll()
1075 retval |= xhci_check_command(sc, &phwr->hwr_events[i]); in xhci_interrupt_poll()
1089 if (!--t) in xhci_interrupt_poll()
1094 sc->sc_event_idx = i; in xhci_interrupt_poll()
1095 sc->sc_event_ccs = j; in xhci_interrupt_poll()
1098 * NOTE: The Event Ring Dequeue Pointer Register is 64-bit in xhci_interrupt_poll()
1100 * write both the low and high double word of the 64-bit in xhci_interrupt_poll()
1133 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_do_command()
1139 USB_BUS_LOCK(&sc->sc_bus); in xhci_do_command()
1141 i = sc->sc_command_idx; in xhci_do_command()
1142 j = sc->sc_command_ccs; in xhci_do_command()
1145 i, XHCI_TRB_3_TYPE_GET(le32toh(trb->dwTrb3)), in xhci_do_command()
1146 (long long)le64toh(trb->qwTrb0), in xhci_do_command()
1147 (long)le32toh(trb->dwTrb2), in xhci_do_command()
1148 (long)le32toh(trb->dwTrb3)); in xhci_do_command()
1150 phwr->hwr_commands[i].qwTrb0 = trb->qwTrb0; in xhci_do_command()
1151 phwr->hwr_commands[i].dwTrb2 = trb->dwTrb2; in xhci_do_command()
1153 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1155 temp = trb->dwTrb3; in xhci_do_command()
1164 phwr->hwr_commands[i].dwTrb3 = temp; in xhci_do_command()
1166 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1171 sc->sc_cmd_addr = htole64(addr); in xhci_do_command()
1175 if (i == (XHCI_MAX_COMMANDS - 1)) { in xhci_do_command()
1185 phwr->hwr_commands[i].dwTrb3 = temp; in xhci_do_command()
1187 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1193 sc->sc_command_idx = i; in xhci_do_command()
1194 sc->sc_command_ccs = j; in xhci_do_command()
1198 err = cv_timedwait(&sc->sc_cmd_cv, &sc->sc_bus.bus_mtx, in xhci_do_command()
1203 * Poll one time to see if the command has completed. in xhci_do_command()
1212 * After some weeks of continuous operation, it has in xhci_do_command()
1221 temp = le32toh(trb->dwTrb3); in xhci_do_command()
1226 * non-enumerating device: in xhci_do_command()
1237 usb_bus_reset_async_locked(&sc->sc_bus); in xhci_do_command()
1240 trb->dwTrb2 = 0; in xhci_do_command()
1241 trb->dwTrb3 = 0; in xhci_do_command()
1243 temp = le32toh(sc->sc_cmd_result[0]); in xhci_do_command()
1247 trb->dwTrb2 = sc->sc_cmd_result[0]; in xhci_do_command()
1248 trb->dwTrb3 = sc->sc_cmd_result[1]; in xhci_do_command()
1251 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_do_command()
1345 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_set_address()
1355 if (udev->parent_hub == NULL) in xhci_set_address()
1358 index = udev->controller_slot_id; in xhci_set_address()
1360 hdev = &sc->sc_hw.devs[index]; in xhci_set_address()
1367 switch (hdev->state) { in xhci_set_address()
1371 hdev->state = XHCI_ST_ENABLED; in xhci_set_address()
1385 switch (udev->speed) { in xhci_set_address()
1399 &udev->ctrl_ep_desc); in xhci_set_address()
1402 USB_BUS_LOCK(udev->bus); in xhci_set_address()
1403 pepext->trb_halted = 1; in xhci_set_address()
1404 pepext->trb_running = 0; in xhci_set_address()
1405 USB_BUS_UNLOCK(udev->bus); in xhci_set_address()
1408 &udev->ctrl_ep_desc, pepext, in xhci_set_address()
1417 usbd_get_page(&hdev->input_pc, 0, &buf_inp); in xhci_set_address()
1423 temp = le32toh(sc->sc_cmd_result[0]); in xhci_set_address()
1424 if (address == 0 && sc->sc_port_route != NULL && in xhci_set_address()
1427 /* LynxPoint XHCI - ports are not switchable */ in xhci_set_address()
1428 /* Un-route all ports from the XHCI */ in xhci_set_address()
1429 sc->sc_port_route(sc->sc_bus.parent, 0, ~0); in xhci_set_address()
1439 usbd_get_page(&hdev->device_pc, 0, &buf_dev); in xhci_set_address()
1442 usb_pc_cpu_invalidate(&hdev->device_pc); in xhci_set_address()
1444 temp = le32toh(slot->dwSctx3); in xhci_set_address()
1445 udev->address = XHCI_SCTX_3_DEV_ADDR_GET(temp); in xhci_set_address()
1450 hdev->state = XHCI_ST_ADDRESSED; in xhci_set_address()
1452 hdev->state = XHCI_ST_DEFAULT; in xhci_set_address()
1483 if (sc->sc_no_deconfigure != 0 || xhcidcepquirk != 0) in xhci_cmd_configure_ep()
1597 /*------------------------------------------------------------------------*
1598 * xhci_interrupt - XHCI interrupt handler
1599 *------------------------------------------------------------------------*/
1606 USB_BUS_LOCK(&sc->sc_bus); in xhci_interrupt()
1646 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_interrupt()
1649 /*------------------------------------------------------------------------*
1650 * xhci_timeout - XHCI timeout handler
1651 *------------------------------------------------------------------------*/
1659 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in xhci_timeout()
1670 USB_BUS_LOCK(&sc->sc_bus); in xhci_do_poll()
1672 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_do_poll()
1694 shortpkt_old = temp->shortpkt; in xhci_setup_generic_chain_sub()
1695 len_old = temp->len; in xhci_setup_generic_chain_sub()
1701 td = temp->td; in xhci_setup_generic_chain_sub()
1702 td_next = td_first = temp->td_next; in xhci_setup_generic_chain_sub()
1705 if (temp->len == 0) { in xhci_setup_generic_chain_sub()
1706 if (temp->shortpkt) in xhci_setup_generic_chain_sub()
1711 temp->shortpkt = 1; in xhci_setup_generic_chain_sub()
1715 average = temp->average; in xhci_setup_generic_chain_sub()
1717 if (temp->len < average) { in xhci_setup_generic_chain_sub()
1718 if (temp->len % temp->max_packet_size) { in xhci_setup_generic_chain_sub()
1719 temp->shortpkt = 1; in xhci_setup_generic_chain_sub()
1721 average = temp->len; in xhci_setup_generic_chain_sub()
1731 td_next = td->obj_next; in xhci_setup_generic_chain_sub()
1733 /* check if we are pre-computing */ in xhci_setup_generic_chain_sub()
1738 temp->len -= average; in xhci_setup_generic_chain_sub()
1744 td->len = average; in xhci_setup_generic_chain_sub()
1745 td->remainder = 0; in xhci_setup_generic_chain_sub()
1746 td->status = 0; in xhci_setup_generic_chain_sub()
1750 temp->len -= average; in xhci_setup_generic_chain_sub()
1756 if (temp->trb_type == XHCI_TRB_TYPE_SETUP_STAGE) { in xhci_setup_generic_chain_sub()
1762 td->td_trb[0].qwTrb0 = 0; in xhci_setup_generic_chain_sub()
1764 usbd_copy_out(temp->pc, temp->offset + buf_offset, in xhci_setup_generic_chain_sub()
1765 (uint8_t *)(uintptr_t)&td->td_trb[0].qwTrb0, in xhci_setup_generic_chain_sub()
1772 td->td_trb[0].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
1778 if (td->td_trb[0].qwTrb0 & in xhci_setup_generic_chain_sub()
1780 if (td->td_trb[0].qwTrb0 & in xhci_setup_generic_chain_sub()
1787 td->td_trb[0].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
1789 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
1801 usbd_get_page(temp->pc, temp->offset + in xhci_setup_generic_chain_sub()
1816 npkt = howmany(len_old - npkt_off, in xhci_setup_generic_chain_sub()
1817 temp->max_packet_size); in xhci_setup_generic_chain_sub()
1825 td->td_trb[x].qwTrb0 = in xhci_setup_generic_chain_sub()
1833 td->td_trb[x].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
1835 switch (temp->trb_type) { in xhci_setup_generic_chain_sub()
1838 XHCI_TRB_3_TBC_SET(temp->tbc) | in xhci_setup_generic_chain_sub()
1839 XHCI_TRB_3_TLBPC_SET(temp->tlbpc); in xhci_setup_generic_chain_sub()
1842 } else if (temp->do_isoc_sync != 0) { in xhci_setup_generic_chain_sub()
1843 temp->do_isoc_sync = 0; in xhci_setup_generic_chain_sub()
1846 XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); in xhci_setup_generic_chain_sub()
1852 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1858 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1864 * normal-TRB if there are more TRBs in xhci_setup_generic_chain_sub()
1865 * extending the data-stage in xhci_setup_generic_chain_sub()
1868 temp->trb_type = XHCI_TRB_TYPE_NORMAL; in xhci_setup_generic_chain_sub()
1873 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1879 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1883 td->td_trb[x].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
1885 average -= buf_res.length; in xhci_setup_generic_chain_sub()
1888 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
1894 td->td_trb[x-1].dwTrb3 |= htole32(XHCI_TRB_3_IOC_BIT); in xhci_setup_generic_chain_sub()
1898 td->ntrb = x; in xhci_setup_generic_chain_sub()
1906 td->td_trb[x].qwTrb0 = htole64((uint64_t)td_next->td_self); in xhci_setup_generic_chain_sub()
1907 DPRINTF("LINK=0x%08llx\n", (long long)td_next->td_self); in xhci_setup_generic_chain_sub()
1915 td->td_trb[x].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
1920 * CHAIN-BIT: Ensure that a multi-TRB IN-endpoint in xhci_setup_generic_chain_sub()
1924 * sending a ZLP unless the CHAIN-BIT is set in in xhci_setup_generic_chain_sub()
1929 td->td_trb[x].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
1931 td->alt_next = td_alt_next; in xhci_setup_generic_chain_sub()
1933 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
1935 usb_pc_cpu_flush(td->page_cache); in xhci_setup_generic_chain_sub()
1942 if (temp->last_frame) { in xhci_setup_generic_chain_sub()
1950 temp->shortpkt = shortpkt_old; in xhci_setup_generic_chain_sub()
1951 temp->len = len_old; in xhci_setup_generic_chain_sub()
1959 if (temp->step_td != 0) { in xhci_setup_generic_chain_sub()
1960 td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); in xhci_setup_generic_chain_sub()
1961 usb_pc_cpu_flush(td_first->page_cache); in xhci_setup_generic_chain_sub()
1966 td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(31)); in xhci_setup_generic_chain_sub()
1967 td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); in xhci_setup_generic_chain_sub()
1968 /* remove CHAIN-BIT from last LINK TRB */ in xhci_setup_generic_chain_sub()
1969 td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); in xhci_setup_generic_chain_sub()
1971 usb_pc_cpu_flush(td->page_cache); in xhci_setup_generic_chain_sub()
1973 temp->td = td; in xhci_setup_generic_chain_sub()
1974 temp->td_next = td_next; in xhci_setup_generic_chain_sub()
1990 temp.average = xfer->max_hc_frame_size; in xhci_setup_generic_chain()
1991 temp.max_packet_size = xfer->max_packet_size; in xhci_setup_generic_chain()
1992 temp.sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_setup_generic_chain()
1996 temp.multishort = xfer->flags_int.isochronous_xfr || in xhci_setup_generic_chain()
1997 xfer->flags_int.control_xfr || in xhci_setup_generic_chain()
1998 xfer->flags_int.short_frames_ok; in xhci_setup_generic_chain()
2001 xfer->flags_int.curr_dma_set ^= 1; in xhci_setup_generic_chain()
2004 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in xhci_setup_generic_chain()
2009 xfer->td_transfer_first = td; in xhci_setup_generic_chain()
2010 xfer->td_transfer_cache = td; in xhci_setup_generic_chain()
2012 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2016 mult = xfer->endpoint->ecomp ? in xhci_setup_generic_chain()
2017 UE_GET_SS_ISO_MULT(xfer->endpoint->ecomp->bmAttributes) in xhci_setup_generic_chain()
2021 mult = (xfer->endpoint->edesc-> in xhci_setup_generic_chain()
2032 DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, temp.sc->sc_ist); in xhci_setup_generic_chain()
2034 switch (usbd_get_speed(xfer->xroot->udev)) { in xhci_setup_generic_chain()
2046 if (temp.sc->sc_ist & 8) in xhci_setup_generic_chain()
2047 y = (temp.sc->sc_ist & 7) << 3; in xhci_setup_generic_chain()
2049 y = (temp.sc->sc_ist & 7); in xhci_setup_generic_chain()
2055 DPRINTFN(3, "IST(%d) is too big!\n", temp.sc->sc_ist); in xhci_setup_generic_chain()
2070 y -= 8; in xhci_setup_generic_chain()
2074 xfer, x, y, 8, XHCI_MFINDEX_GET(-1), &temp.isoc_frame)) { in xhci_setup_generic_chain()
2084 } else if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2087 if (xfer->flags_int.control_hdr) { in xhci_setup_generic_chain()
2088 temp.len = xfer->frlengths[0]; in xhci_setup_generic_chain()
2089 temp.pc = xfer->frbuffers + 0; in xhci_setup_generic_chain()
2095 if (xfer->nframes == 1) { in xhci_setup_generic_chain()
2097 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2107 temp.trb_type = xfer->flags_int.control_did_data ? in xhci_setup_generic_chain()
2117 if (x != xfer->nframes) { in xhci_setup_generic_chain()
2119 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2121 temp.direction = UE_GET_DIR(xfer->endpointno); in xhci_setup_generic_chain()
2124 while (x != xfer->nframes) { in xhci_setup_generic_chain()
2127 temp.len = xfer->frlengths[x]; in xhci_setup_generic_chain()
2128 temp.step_td = ((xfer->endpointno & UE_DIR_IN) && in xhci_setup_generic_chain()
2133 if (x == xfer->nframes) { in xhci_setup_generic_chain()
2134 if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2136 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2148 temp.tlbpc = mult - 1; in xhci_setup_generic_chain()
2150 } else if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2162 if (temp.len > xfer->max_frame_size) in xhci_setup_generic_chain()
2163 temp.len = xfer->max_frame_size; in xhci_setup_generic_chain()
2166 tdpc = howmany(temp.len, xfer->max_packet_size); in xhci_setup_generic_chain()
2168 temp.tbc = howmany(tdpc, mult) - 1; in xhci_setup_generic_chain()
2172 temp.tlbpc = mult - 1; in xhci_setup_generic_chain()
2174 temp.tlbpc--; in xhci_setup_generic_chain()
2178 temp.shortpkt = xfer->flags.force_short_xfer ? 0 : 1; in xhci_setup_generic_chain()
2183 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2184 temp.offset += xfer->frlengths[x - 1]; in xhci_setup_generic_chain()
2188 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2194 if (xfer->flags_int.control_xfr && in xhci_setup_generic_chain()
2195 !xfer->flags_int.control_act) { in xhci_setup_generic_chain()
2200 if (xhcictlstep || temp.sc->sc_ctlstep) { in xhci_setup_generic_chain()
2207 temp.step_td = (xfer->nframes != 0); in xhci_setup_generic_chain()
2211 temp.direction = UE_GET_DIR(xfer->endpointno) ^ UE_DIR_IN; in xhci_setup_generic_chain()
2225 xfer->td_transfer_last = td; in xhci_setup_generic_chain()
2227 DPRINTF("first=%p last=%p\n", xfer->td_transfer_first, td); in xhci_setup_generic_chain()
2236 usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res); in xhci_set_slot_pointer()
2242 pdctxa->qwBaaDevCtxAddr[index] = htole64(dev_addr); in xhci_set_slot_pointer()
2244 usb_pc_cpu_flush(&sc->sc_hw.ctx_pc); in xhci_set_slot_pointer()
2250 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_mask()
2258 index = udev->controller_slot_id; in xhci_configure_mask()
2260 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_configure_mask()
2268 input->dwInCtx0 = htole32(mask); in xhci_configure_mask()
2269 input->dwInCtx1 = htole32(0); in xhci_configure_mask()
2275 input->dwInCtx0 = htole32(mask & XHCI_INCTX_NON_CTRL_MASK); in xhci_configure_mask()
2278 input->dwInCtx1 = htole32(mask); in xhci_configure_mask()
2281 for (x = 31; x != 1; x--) { in xhci_configure_mask()
2287 x--; in xhci_configure_mask()
2290 if (x > sc->sc_hw.devs[index].context_num) in xhci_configure_mask()
2291 sc->sc_hw.devs[index].context_num = x; in xhci_configure_mask()
2293 x = sc->sc_hw.devs[index].context_num; in xhci_configure_mask()
2296 temp = le32toh(slot->dwSctx0); in xhci_configure_mask()
2299 slot->dwSctx0 = htole32(temp); in xhci_configure_mask()
2301 usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); in xhci_configure_mask()
2313 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_endpoint()
2315 uint64_t ring_addr = pepext->physaddr; in xhci_configure_endpoint()
2321 index = udev->controller_slot_id; in xhci_configure_endpoint()
2323 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_configure_endpoint()
2325 epno = edesc->bEndpointAddress; in xhci_configure_endpoint()
2326 type = edesc->bmAttributes & UE_XFERTYPE; in xhci_configure_endpoint()
2339 max_packet_count--; in xhci_configure_endpoint()
2344 endp = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_ep[epno - 1], in xhci_configure_endpoint()
2348 pepext->trb_ep_mode = ep_mode; in xhci_configure_endpoint()
2350 pepext->trb_ep_maxp = edesc->wMaxPacketSize[0]; in xhci_configure_endpoint()
2351 usb_pc_cpu_flush(pepext->page_cache); in xhci_configure_endpoint()
2355 XHCI_EPCTX_0_MAXP_STREAMS_SET(XHCI_MAX_STREAMS_LOG - 1) | in xhci_configure_endpoint()
2368 switch (udev->speed) { in xhci_configure_endpoint()
2371 /* 1ms -> 125us */ in xhci_configure_endpoint()
2381 fps_shift--; in xhci_configure_endpoint()
2387 switch (udev->speed) { in xhci_configure_endpoint()
2391 temp |= XHCI_EPCTX_0_MULT_SET(mult - 1); in xhci_configure_endpoint()
2402 endp->dwEpCtx0 = htole32(temp); in xhci_configure_endpoint()
2437 endp->dwEpCtx1 = htole32(temp); in xhci_configure_endpoint()
2438 endp->qwEpCtx2 = htole64(ring_addr); in xhci_configure_endpoint()
2440 switch (edesc->bmAttributes & UE_XFERTYPE) { in xhci_configure_endpoint()
2455 endp->dwEpCtx4 = htole32(temp); in xhci_configure_endpoint()
2460 usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); in xhci_configure_endpoint()
2472 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2473 xfer->endpoint->edesc); in xhci_configure_endpoint_by_xfer()
2475 ecomp = xfer->endpoint->ecomp; in xhci_configure_endpoint_by_xfer()
2481 pepext->trb[x * XHCI_MAX_TRANSFERS].dwTrb3 = 0; in xhci_configure_endpoint_by_xfer()
2484 temp = pepext->physaddr + in xhci_configure_endpoint_by_xfer()
2489 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2493 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2495 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2498 usb_pc_cpu_flush(pepext->page_cache); in xhci_configure_endpoint_by_xfer()
2500 return (xhci_configure_endpoint(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2501 xfer->endpoint->edesc, pepext, in xhci_configure_endpoint_by_xfer()
2502 xfer->interval, xfer->max_packet_count, in xhci_configure_endpoint_by_xfer()
2503 (ecomp != NULL) ? UE_GET_SS_ISO_MULT(ecomp->bmAttributes) + 1 : 1, in xhci_configure_endpoint_by_xfer()
2504 usbd_xfer_get_fps_shift(xfer), xfer->max_packet_size, in xhci_configure_endpoint_by_xfer()
2505 xfer->max_frame_size, xfer->endpoint->ep_mode)); in xhci_configure_endpoint_by_xfer()
2511 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_device()
2523 index = udev->controller_slot_id; in xhci_configure_device()
2527 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_configure_device()
2538 for (hubdev = udev; hubdev != NULL; hubdev = hubdev->parent_hub) { in xhci_configure_device()
2539 if (hubdev->parent_hub == NULL) in xhci_configure_device()
2542 depth = hubdev->parent_hub->depth; in xhci_configure_device()
2549 rh_port = hubdev->port_no; in xhci_configure_device()
2558 route |= rh_port << (4 * (depth - 1)); in xhci_configure_device()
2565 sc->sc_hw.devs[index].context_num + 1); in xhci_configure_device()
2567 switch (udev->speed) { in xhci_configure_device()
2570 if (udev->parent_hs_hub != NULL && in xhci_configure_device()
2571 udev->parent_hs_hub->ddesc.bDeviceProtocol == in xhci_configure_device()
2579 if (sc->sc_hw.devs[index].nports != 0 && in xhci_configure_device()
2580 udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBMTT) { in xhci_configure_device()
2587 if (udev->parent_hs_hub != NULL && in xhci_configure_device()
2588 udev->parent_hs_hub->ddesc.bDeviceProtocol == in xhci_configure_device()
2599 is_hub = sc->sc_hw.devs[index].nports != 0 && in xhci_configure_device()
2600 (udev->speed == USB_SPEED_SUPER || in xhci_configure_device()
2601 udev->speed == USB_SPEED_HIGH); in xhci_configure_device()
2606 slot->dwSctx0 = htole32(temp); in xhci_configure_device()
2612 sc->sc_hw.devs[index].nports); in xhci_configure_device()
2615 slot->dwSctx1 = htole32(temp); in xhci_configure_device()
2621 sc->sc_hw.devs[index].tt); in xhci_configure_device()
2624 hubdev = udev->parent_hs_hub; in xhci_configure_device()
2626 /* check if we should activate the transaction translator */ in xhci_configure_device()
2627 switch (udev->speed) { in xhci_configure_device()
2632 hubdev->controller_slot_id); in xhci_configure_device()
2634 udev->hs_port_no); in xhci_configure_device()
2641 slot->dwSctx2 = htole32(temp); in xhci_configure_device()
2645 * XHCI section 6.2.2 - slot context: in xhci_configure_device()
2650 slot->dwSctx3 = htole32(temp); in xhci_configure_device()
2663 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_alloc_device_ext()
2673 index = udev->controller_slot_id; in xhci_alloc_device_ext()
2675 pc = &sc->sc_hw.devs[index].device_pc; in xhci_alloc_device_ext()
2676 pg = &sc->sc_hw.devs[index].device_pg; in xhci_alloc_device_ext()
2679 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2681 if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? in xhci_alloc_device_ext()
2688 pc = &sc->sc_hw.devs[index].input_pc; in xhci_alloc_device_ext()
2689 pg = &sc->sc_hw.devs[index].input_pg; in xhci_alloc_device_ext()
2692 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2694 if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? in xhci_alloc_device_ext()
2703 pc = &sc->sc_hw.devs[index].endpoint_pc[i]; in xhci_alloc_device_ext()
2704 pg = &sc->sc_hw.devs[index].endpoint_pg[i]; in xhci_alloc_device_ext()
2707 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2719 trb += XHCI_MAX_TRANSFERS - 1; in xhci_alloc_device_ext()
2725 trb->qwTrb0 = htole64(addr); in xhci_alloc_device_ext()
2726 trb->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_alloc_device_ext()
2727 trb->dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT | in xhci_alloc_device_ext()
2746 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_free_device_ext()
2750 index = udev->controller_slot_id; in xhci_free_device_ext()
2753 usb_pc_free_mem(&sc->sc_hw.devs[index].device_pc); in xhci_free_device_ext()
2754 usb_pc_free_mem(&sc->sc_hw.devs[index].input_pc); in xhci_free_device_ext()
2756 usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc[i]); in xhci_free_device_ext()
2762 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_get_endpoint_ext()
2769 epno = edesc->bEndpointAddress; in xhci_get_endpoint_ext()
2770 if ((edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) in xhci_get_endpoint_ext()
2775 index = udev->controller_slot_id; in xhci_get_endpoint_ext()
2777 pc = &sc->sc_hw.devs[index].endpoint_pc[epno]; in xhci_get_endpoint_ext()
2781 pepext = &sc->sc_hw.devs[index].endp[epno]; in xhci_get_endpoint_ext()
2782 pepext->page_cache = pc; in xhci_get_endpoint_ext()
2783 pepext->trb = buf_ep.buffer; in xhci_get_endpoint_ext()
2784 pepext->physaddr = buf_ep.physaddr; in xhci_get_endpoint_ext()
2792 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_endpoint_doorbell()
2796 epno = xfer->endpointno; in xhci_endpoint_doorbell()
2797 if (xfer->flags_int.control_xfr) in xhci_endpoint_doorbell()
2801 index = xfer->xroot->udev->controller_slot_id; in xhci_endpoint_doorbell()
2803 if (xfer->xroot->udev->flags.self_suspended == 0) { in xhci_endpoint_doorbell()
2805 epno | XHCI_DB_SID_SET(xfer->stream_id)); in xhci_endpoint_doorbell()
2814 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_remove()
2815 xfer->flags_int.bandwidth_reclaimed = 0; in xhci_transfer_remove()
2817 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_remove()
2818 xfer->endpoint->edesc); in xhci_transfer_remove()
2820 pepext->trb_used[xfer->stream_id]--; in xhci_transfer_remove()
2822 pepext->xfer[xfer->qh_pos] = NULL; in xhci_transfer_remove()
2824 if (error && pepext->trb_running != 0) { in xhci_transfer_remove()
2825 pepext->trb_halted = 1; in xhci_transfer_remove()
2826 pepext->trb_running = 0; in xhci_transfer_remove()
2846 id = xfer->stream_id; in xhci_transfer_insert()
2849 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_insert()
2854 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_insert()
2855 xfer->endpoint->edesc); in xhci_transfer_insert()
2857 td_first = xfer->td_transfer_first; in xhci_transfer_insert()
2858 td_last = xfer->td_transfer_last; in xhci_transfer_insert()
2859 addr = pepext->physaddr; in xhci_transfer_insert()
2861 switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) { in xhci_transfer_insert()
2869 trb_limit = (XHCI_MAX_TRANSFERS - 2); in xhci_transfer_insert()
2873 if (pepext->trb_used[id] >= trb_limit) { in xhci_transfer_insert()
2879 if (xfer->flags_int.control_xfr != 0 && in xhci_transfer_insert()
2880 pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { in xhci_transfer_insert()
2884 pepext->trb_halted = 1; in xhci_transfer_insert()
2885 pepext->trb_running = 0; in xhci_transfer_insert()
2889 if (pepext->trb_running == 0) { in xhci_transfer_insert()
2890 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_transfer_insert()
2895 (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), in xhci_transfer_insert()
2896 &sc->sc_config_msg[0], &sc->sc_config_msg[1]); in xhci_transfer_insert()
2900 pepext->trb_used[id]++; in xhci_transfer_insert()
2903 i = pepext->trb_index[id]; in xhci_transfer_insert()
2909 if (inext >= (XHCI_MAX_TRANSFERS - 1)) in xhci_transfer_insert()
2913 pepext->trb_index[id] = inext; in xhci_transfer_insert()
2923 trb_link = td_last->td_trb + td_last->ntrb; in xhci_transfer_insert()
2926 trb_link->qwTrb0 = htole64(addr); in xhci_transfer_insert()
2927 trb_link->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_transfer_insert()
2928 trb_link->dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | in xhci_transfer_insert()
2933 xhci_dump_trb(&td_last->td_trb[td_last->ntrb]); in xhci_transfer_insert()
2935 usb_pc_cpu_flush(td_last->page_cache); in xhci_transfer_insert()
2939 pepext->trb[inext].qwTrb0 = 0; in xhci_transfer_insert()
2940 pepext->trb[inext].dwTrb2 = 0; in xhci_transfer_insert()
2941 pepext->trb[inext].dwTrb3 = 0; in xhci_transfer_insert()
2945 pepext->trb[i].qwTrb0 = htole64((uint64_t)td_first->td_self); in xhci_transfer_insert()
2946 pepext->trb[i].dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_transfer_insert()
2949 xhci_dump_trb(&pepext->trb[i]); in xhci_transfer_insert()
2951 usb_pc_cpu_flush(pepext->page_cache); in xhci_transfer_insert()
2955 pepext->trb[i].dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT | in xhci_transfer_insert()
2958 usb_pc_cpu_flush(pepext->page_cache); in xhci_transfer_insert()
2962 pepext->xfer[i] = xfer; in xhci_transfer_insert()
2964 xfer->qh_pos = i; in xhci_transfer_insert()
2966 xfer->flags_int.bandwidth_reclaimed = 1; in xhci_transfer_insert()
2978 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in xhci_root_intr()
2981 memset(sc->sc_hub_idata, 0, sizeof(sc->sc_hub_idata)); in xhci_root_intr()
2983 for (i = 1; i <= sc->sc_noport; i++) { in xhci_root_intr()
2990 sc->sc_hub_idata[i / 8] |= 1 << (i % 8); in xhci_root_intr()
2994 uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, in xhci_root_intr()
2995 sizeof(sc->sc_hub_idata)); in xhci_root_intr()
2998 /*------------------------------------------------------------------------*
2999 * xhci_device_done - XHCI done handler
3003 *------------------------------------------------------------------------*/
3008 xfer, xfer->endpoint, error); in xhci_device_done()
3017 /*------------------------------------------------------------------------*
3019 *------------------------------------------------------------------------*/
3041 xfer = ep->endpoint_q[stream_id].curr; in xhci_device_generic_multi_enter()
3050 if (!xfer->flags_int.bandwidth_reclaimed) in xhci_device_generic_multi_enter()
3053 xfer = TAILQ_FIRST(&ep->endpoint_q[stream_id].head); in xhci_device_generic_multi_enter()
3078 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_enter()
3079 xfer->stream_id, xfer); in xhci_device_generic_enter()
3091 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_start()
3092 xfer->stream_id, NULL); in xhci_device_generic_start()
3095 usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); in xhci_device_generic_start()
3098 if (xfer->timeout != 0) in xhci_device_generic_start()
3099 usbd_transfer_timeout_ms(xfer, &xhci_timeout, xfer->timeout); in xhci_device_generic_start()
3110 /*------------------------------------------------------------------------*
3112 *------------------------------------------------------------------------*
3114 *------------------------------------------------------------------------*/
3157 .bU1DevExitLat = 255, /* dummy - not used */
3215 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_roothub_exec()
3227 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in xhci_roothub_exec()
3230 ptr = (const void *)&sc->sc_hub_desc; in xhci_roothub_exec()
3234 value = UGETW(req->wValue); in xhci_roothub_exec()
3235 index = UGETW(req->wIndex); in xhci_roothub_exec()
3239 req->bmRequestType, req->bRequest, in xhci_roothub_exec()
3240 UGETW(req->wLength), value, index); in xhci_roothub_exec()
3243 switch (C(req->bRequest, req->bmRequestType)) { in xhci_roothub_exec()
3248 * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops in xhci_roothub_exec()
3254 sc->sc_hub_desc.temp[0] = sc->sc_conf; in xhci_roothub_exec()
3292 str_ptr = sc->sc_vendor; in xhci_roothub_exec()
3305 sc->sc_hub_desc.temp, in xhci_roothub_exec()
3306 sizeof(sc->sc_hub_desc.temp), in xhci_roothub_exec()
3317 sc->sc_hub_desc.temp[0] = 0; in xhci_roothub_exec()
3321 USETW(sc->sc_hub_desc.stat.wStatus, UDS_SELF_POWERED); in xhci_roothub_exec()
3326 USETW(sc->sc_hub_desc.stat.wStatus, 0); in xhci_roothub_exec()
3339 sc->sc_conf = value; in xhci_roothub_exec()
3359 (index > sc->sc_noport)) { in xhci_roothub_exec()
3393 if ((sc->sc_quirks & XHCI_QUIRK_DISABLE_PORT_PED) == 0) in xhci_roothub_exec()
3404 /* U3 -> U15 */ in xhci_roothub_exec()
3411 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50); in xhci_roothub_exec()
3431 sc->sc_hub_desc.hubd = xhci_hubd; in xhci_roothub_exec()
3433 sc->sc_hub_desc.hubd.bNbrPorts = sc->sc_noport; in xhci_roothub_exec()
3445 USETW(sc->sc_hub_desc.hubd.wHubCharacteristics, i); in xhci_roothub_exec()
3448 sc->sc_hub_desc.hubd.bPwrOn2PwrGood = 10; in xhci_roothub_exec()
3450 for (j = 1; j <= sc->sc_noport; j++) { in xhci_roothub_exec()
3453 sc->sc_hub_desc.hubd. in xhci_roothub_exec()
3457 len = sc->sc_hub_desc.hubd.bLength; in xhci_roothub_exec()
3462 memset(sc->sc_hub_desc.temp, 0, 16); in xhci_roothub_exec()
3469 (index > sc->sc_noport)) { in xhci_roothub_exec()
3507 USETW(sc->sc_hub_desc.ps.wPortStatus, i); in xhci_roothub_exec()
3525 USETW(sc->sc_hub_desc.ps.wPortChange, i); in xhci_roothub_exec()
3526 len = sizeof(sc->sc_hub_desc.ps); in xhci_roothub_exec()
3542 (index > sc->sc_noport)) { in xhci_roothub_exec()
3580 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 250); in xhci_roothub_exec()
3589 /* non-supported speed */ in xhci_roothub_exec()
3646 xfer = parm->curr_xfer; in xhci_xfer_setup()
3651 * +------------------------------------+ in xhci_xfer_setup()
3653 * | |remainder -> | in xhci_xfer_setup()
3654 * | +-----+---+ | in xhci_xfer_setup()
3656 * | +-----+---++ | in xhci_xfer_setup()
3658 * | +-----+----+ | in xhci_xfer_setup()
3660 * +------------------------------------+ in xhci_xfer_setup()
3676 parm->hc_max_packet_size = 0x400; in xhci_xfer_setup()
3677 parm->hc_max_packet_count = 16 * 3; in xhci_xfer_setup()
3678 parm->hc_max_frame_size = XHCI_TD_PAYLOAD_MAX; in xhci_xfer_setup()
3680 xfer->flags_int.bdma_enable = 1; in xhci_xfer_setup()
3684 if (xfer->flags_int.isochronous_xfr) { in xhci_xfer_setup()
3685 ntd = ((1 * xfer->nframes) in xhci_xfer_setup()
3686 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3687 } else if (xfer->flags_int.control_xfr) { in xhci_xfer_setup()
3688 ntd = ((2 * xfer->nframes) + 1 /* STATUS */ in xhci_xfer_setup()
3689 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3691 ntd = ((2 * xfer->nframes) in xhci_xfer_setup()
3692 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3697 if (parm->err) in xhci_xfer_setup()
3708 parm->err = USB_ERR_NOMEM; in xhci_xfer_setup()
3711 if (parm->buf) { in xhci_xfer_setup()
3720 td->td_self = page_info.physaddr; in xhci_xfer_setup()
3721 td->obj_next = last_obj; in xhci_xfer_setup()
3722 td->page_cache = pc + n; in xhci_xfer_setup()
3729 xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; in xhci_xfer_setup()
3731 if (!xfer->flags_int.curr_dma_set) { in xhci_xfer_setup()
3732 xfer->flags_int.curr_dma_set = 1; in xhci_xfer_setup()
3740 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_get_endpoint_state()
3748 hdev = &sc->sc_hw.devs[udev->controller_slot_id]; in xhci_get_endpoint_state()
3750 usbd_get_page(&hdev->device_pc, 0, &buf_dev); in xhci_get_endpoint_state()
3751 endp = XHCI_GET_CTX(sc, xhci_dev_ctx, ctx_ep[epno - 1], in xhci_get_endpoint_state()
3753 usb_pc_cpu_invalidate(&hdev->device_pc); in xhci_get_endpoint_state()
3755 temp = le32toh(endp->dwEpCtx0); in xhci_get_endpoint_state()
3763 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_configure_reset_endpoint()
3776 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_reset_endpoint()
3777 xfer->endpoint->edesc); in xhci_configure_reset_endpoint()
3779 udev = xfer->xroot->udev; in xhci_configure_reset_endpoint()
3780 index = udev->controller_slot_id; in xhci_configure_reset_endpoint()
3782 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_configure_reset_endpoint()
3786 edesc = xfer->endpoint->edesc; in xhci_configure_reset_endpoint()
3788 epno = edesc->bEndpointAddress; in xhci_configure_reset_endpoint()
3789 stream_id = xfer->stream_id; in xhci_configure_reset_endpoint()
3791 if ((edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) in xhci_configure_reset_endpoint()
3836 (pepext->physaddr + (stream_id * sizeof(struct xhci_trb) * in xhci_configure_reset_endpoint()
3851 * So-called control and isochronous transfer types have in xhci_configure_reset_endpoint()
3856 (edesc->bmAttributes & UE_XFERTYPE) != UE_CONTROL && in xhci_configure_reset_endpoint()
3857 (edesc->bmAttributes & UE_XFERTYPE) != UE_ISOCHRONOUS) { in xhci_configure_reset_endpoint()
3865 sc->sc_hw.devs[index].ep_configured &= ~mask; in xhci_configure_reset_endpoint()
3875 if (!(sc->sc_hw.devs[index].ep_configured & mask)) { in xhci_configure_reset_endpoint()
3878 sc->sc_hw.devs[index].ep_configured |= mask; in xhci_configure_reset_endpoint()
3901 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_start_dma_delay()
3904 usbd_transfer_enqueue(&sc->sc_bus.intr_q, xfer); in xhci_start_dma_delay()
3906 (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), in xhci_start_dma_delay()
3907 &sc->sc_config_msg[0], &sc->sc_config_msg[1]); in xhci_start_dma_delay()
3917 sc = XHCI_BUS2SC(((struct usb_bus_msg *)pm)->bus); in xhci_configure_msg()
3920 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
3921 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_msg()
3922 xfer->endpoint->edesc); in xhci_configure_msg()
3924 if ((pepext->trb_halted != 0) || in xhci_configure_msg()
3925 (pepext->trb_running == 0)) { in xhci_configure_msg()
3929 pepext->trb_halted = 0; in xhci_configure_msg()
3930 pepext->trb_running = 0; in xhci_configure_msg()
3942 if (pepext->xfer[i] != NULL) { in xhci_configure_msg()
3943 xhci_device_done(pepext->xfer[i], in xhci_configure_msg()
3953 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_configure_msg()
3957 USB_BUS_LOCK(&sc->sc_bus); in xhci_configure_msg()
3960 if (pepext->trb_halted == 0) { in xhci_configure_msg()
3961 pepext->trb_running = 1; in xhci_configure_msg()
3962 memset(pepext->trb_index, 0, in xhci_configure_msg()
3963 sizeof(pepext->trb_index)); in xhci_configure_msg()
3968 if (xfer->flags_int.did_dma_delay) { in xhci_configure_msg()
3975 /* queue changed - restart */ in xhci_configure_msg()
3980 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
3985 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_configure_msg()
3986 xfer->stream_id, NULL); in xhci_configure_msg()
4000 ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); in xhci_ep_init()
4002 if (udev->parent_hub == NULL) { in xhci_ep_init()
4003 /* root HUB has special endpoint handling */ in xhci_ep_init()
4007 ep->methods = &xhci_device_generic_methods; in xhci_ep_init()
4011 USB_BUS_LOCK(udev->bus); in xhci_ep_init()
4012 pepext->trb_halted = 1; in xhci_ep_init()
4013 pepext->trb_running = 0; in xhci_ep_init()
4017 * endpoints, we need to re-configure the XHCI endpoint in xhci_ep_init()
4020 if ((edesc->bEndpointAddress & UE_ADDR) != 0) { in xhci_ep_init()
4021 sc = XHCI_BUS2SC(udev->bus); in xhci_ep_init()
4022 index = udev->controller_slot_id; in xhci_ep_init()
4023 epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); in xhci_ep_init()
4024 sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); in xhci_ep_init()
4026 USB_BUS_UNLOCK(udev->bus); in xhci_ep_init()
4032 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_ep_uninit()
4033 const struct usb_endpoint_descriptor *edesc = ep->edesc; in xhci_ep_uninit()
4041 if (udev->parent_hub == NULL) { in xhci_ep_uninit()
4042 /* root HUB has special endpoint handling */ in xhci_ep_uninit()
4046 if ((edesc->bEndpointAddress & UE_ADDR) == 0) { in xhci_ep_uninit()
4052 index = udev->controller_slot_id; in xhci_ep_uninit()
4053 epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); in xhci_ep_uninit()
4056 if (sc->sc_hw.devs[index].ep_configured & mask) { in xhci_ep_uninit()
4057 USB_BUS_LOCK(udev->bus); in xhci_ep_uninit()
4059 USB_BUS_UNLOCK(udev->bus); in xhci_ep_uninit()
4061 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_ep_uninit()
4067 USB_BUS_LOCK(udev->bus); in xhci_ep_uninit()
4068 sc->sc_hw.devs[index].ep_configured &= ~mask; in xhci_ep_uninit()
4069 USB_BUS_UNLOCK(udev->bus); in xhci_ep_uninit()
4082 if (udev->flags.usb_mode != USB_MODE_HOST) { in xhci_ep_clear_stall()
4086 if (udev->parent_hub == NULL) { in xhci_ep_clear_stall()
4087 /* root HUB has special endpoint handling */ in xhci_ep_clear_stall()
4091 pepext = xhci_get_endpoint_ext(udev, ep->edesc); in xhci_ep_clear_stall()
4093 USB_BUS_LOCK(udev->bus); in xhci_ep_clear_stall()
4094 pepext->trb_halted = 1; in xhci_ep_clear_stall()
4095 pepext->trb_running = 0; in xhci_ep_clear_stall()
4096 USB_BUS_UNLOCK(udev->bus); in xhci_ep_clear_stall()
4102 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_init()
4107 if (udev->parent_hub == NULL) in xhci_device_init()
4114 udev->controller_slot_id = sc->sc_noslot + 1; in xhci_device_init()
4125 if (temp > sc->sc_noslot) { in xhci_device_init()
4130 if (sc->sc_hw.devs[temp].state != XHCI_ST_DISABLED) { in xhci_device_init()
4138 udev->controller_slot_id = temp; in xhci_device_init()
4142 memset(&sc->sc_hw.devs[temp], 0, sizeof(sc->sc_hw.devs[0])); in xhci_device_init()
4146 sc->sc_hw.devs[temp].state = XHCI_ST_ENABLED; in xhci_device_init()
4163 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_uninit()
4167 if (udev->parent_hub == NULL) in xhci_device_uninit()
4172 index = udev->controller_slot_id; in xhci_device_uninit()
4174 if (index <= sc->sc_noslot) { in xhci_device_uninit()
4176 sc->sc_hw.devs[index].state = XHCI_ST_DISABLED; in xhci_device_uninit()
4189 * Wait until the hardware has finished any possible use of in xhci_get_dma_delay()
4198 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_resume()
4206 if (udev->parent_hub == NULL) in xhci_device_resume()
4209 index = udev->controller_slot_id; in xhci_device_resume()
4215 USB_BUS_LOCK(udev->bus); in xhci_device_resume()
4224 USB_BUS_UNLOCK(udev->bus); in xhci_device_resume()
4232 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_suspend()
4240 if (udev->parent_hub == NULL) in xhci_device_suspend()
4243 index = udev->controller_slot_id; in xhci_device_suspend()
4269 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_state_change()
4275 if (udev->parent_hub == NULL) in xhci_device_state_change()
4278 index = udev->controller_slot_id; in xhci_device_state_change()
4283 err = uhub_query_info(udev, &sc->sc_hw.devs[index].nports, in xhci_device_state_change()
4284 &sc->sc_hw.devs[index].tt); in xhci_device_state_change()
4286 sc->sc_hw.devs[index].nports = 0; in xhci_device_state_change()
4293 if (sc->sc_hw.devs[index].state == XHCI_ST_DEFAULT) in xhci_device_state_change()
4297 sc->sc_hw.devs[index].state = XHCI_ST_DEFAULT; in xhci_device_state_change()
4298 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4301 sc->sc_hw.devs[index].context_num = 0; in xhci_device_state_change()
4312 if (sc->sc_hw.devs[index].state == XHCI_ST_ADDRESSED) in xhci_device_state_change()
4315 sc->sc_hw.devs[index].state = XHCI_ST_ADDRESSED; in xhci_device_state_change()
4316 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4331 if (sc->sc_hw.devs[index].state == XHCI_ST_CONFIGURED) { in xhci_device_state_change()
4342 sc->sc_hw.devs[index].state = XHCI_ST_CONFIGURED; in xhci_device_state_change()
4343 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4346 sc->sc_hw.devs[index].context_num = 0; in xhci_device_state_change()
4348 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_device_state_change()
4380 (ep->edesc->bmAttributes & UE_XFERTYPE) != UE_BULK || in xhci_set_endpoint_mode()
4381 udev->speed != USB_SPEED_SUPER) in xhci_set_endpoint_mode()