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");
183 DPRINTFN(5, "qwTrb0 = 0x%016llx\n", (long long)le64toh(trb->qwTrb0)); in xhci_dump_trb()
184 DPRINTFN(5, "dwTrb2 = 0x%08x\n", le32toh(trb->dwTrb2)); in xhci_dump_trb()
185 DPRINTFN(5, "dwTrb3 = 0x%08x\n", le32toh(trb->dwTrb3)); in xhci_dump_trb()
192 DPRINTFN(5, "dwEpCtx0=0x%08x\n", le32toh(pep->dwEpCtx0)); in xhci_dump_endpoint()
193 DPRINTFN(5, "dwEpCtx1=0x%08x\n", le32toh(pep->dwEpCtx1)); in xhci_dump_endpoint()
194 DPRINTFN(5, "qwEpCtx2=0x%016llx\n", (long long)le64toh(pep->qwEpCtx2)); in xhci_dump_endpoint()
195 DPRINTFN(5, "dwEpCtx4=0x%08x\n", le32toh(pep->dwEpCtx4)); in xhci_dump_endpoint()
196 DPRINTFN(5, "dwEpCtx5=0x%08x\n", le32toh(pep->dwEpCtx5)); in xhci_dump_endpoint()
197 DPRINTFN(5, "dwEpCtx6=0x%08x\n", le32toh(pep->dwEpCtx6)); in xhci_dump_endpoint()
198 DPRINTFN(5, "dwEpCtx7=0x%08x\n", le32toh(pep->dwEpCtx7)); in xhci_dump_endpoint()
205 DPRINTFN(5, "dwSctx0=0x%08x\n", le32toh(psl->dwSctx0)); in xhci_dump_device()
206 DPRINTFN(5, "dwSctx1=0x%08x\n", le32toh(psl->dwSctx1)); in xhci_dump_device()
207 DPRINTFN(5, "dwSctx2=0x%08x\n", le32toh(psl->dwSctx2)); in xhci_dump_device()
208 DPRINTFN(5, "dwSctx3=0x%08x\n", le32toh(psl->dwSctx3)); in xhci_dump_device()
228 cb(bus, &sc->sc_hw.root_pc, &sc->sc_hw.root_pg, in xhci_iterate_hw_softc()
231 cb(bus, &sc->sc_hw.ctx_pc, &sc->sc_hw.ctx_pg, in xhci_iterate_hw_softc()
234 for (i = 0; i != sc->sc_noscratch; i++) { in xhci_iterate_hw_softc()
235 cb(bus, &sc->sc_hw.scratch_pc[i], &sc->sc_hw.scratch_pg[i], in xhci_iterate_hw_softc()
269 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 4); in xhci_reset_command_queue_locked()
280 sc->sc_command_ccs = 1; in xhci_reset_command_queue_locked()
281 sc->sc_command_idx = 0; in xhci_reset_command_queue_locked()
283 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_reset_command_queue_locked()
292 memset(phwr->hwr_commands, 0, sizeof(phwr->hwr_commands)); in xhci_reset_command_queue_locked()
293 phwr->hwr_commands[XHCI_MAX_COMMANDS - 1].qwTrb0 = htole64(addr); in xhci_reset_command_queue_locked()
295 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_reset_command_queue_locked()
316 sc->sc_event_ccs = 1; in xhci_start_controller()
317 sc->sc_event_idx = 0; in xhci_start_controller()
318 sc->sc_command_ccs = 1; in xhci_start_controller()
319 sc->sc_command_idx = 0; in xhci_start_controller()
326 DPRINTF("CONFIG=0x%08x -> 0x%08x\n", in xhci_start_controller()
327 XREAD4(sc, oper, XHCI_CONFIG), sc->sc_noslot); in xhci_start_controller()
329 XWRITE4(sc, oper, XHCI_CONFIG, sc->sc_noslot); in xhci_start_controller()
339 usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res); in xhci_start_controller()
347 pdctxa->qwBaaDevCtxAddr[0] = htole64(addr); in xhci_start_controller()
349 for (i = 0; i != sc->sc_noscratch; i++) { in xhci_start_controller()
351 usbd_get_page(&sc->sc_hw.scratch_pc[i], 0, &buf_scp); in xhci_start_controller()
352 pdctxa->qwSpBufPtr[i] = htole64((uint64_t)buf_scp.physaddr); in xhci_start_controller()
363 DPRINTF("ERSTSZ=0x%08x -> 0x%08x\n", in xhci_start_controller()
364 XREAD4(sc, runt, XHCI_ERSTSZ(0)), sc->sc_erst_max); in xhci_start_controller()
366 XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(sc->sc_erst_max)); in xhci_start_controller()
369 XWRITE4(sc, runt, XHCI_IMOD(0), sc->sc_imod_default); in xhci_start_controller()
371 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_start_controller()
380 phwr->hwr_ring_seg[0].qwEvrsTablePtr = htole64(addr); in xhci_start_controller()
381 phwr->hwr_ring_seg[0].dwEvrsTableSize = htole32(XHCI_MAX_EVENTS); in xhci_start_controller()
394 usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_start_controller()
422 phwr->hwr_commands[XHCI_MAX_COMMANDS - 1].qwTrb0 = htole64(addr); in xhci_start_controller()
424 usb_bus_mem_flush_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_start_controller()
438 device_printf(sc->sc_bus.parent, "Run timeout.\n"); in xhci_start_controller()
443 xhci_do_poll(&sc->sc_bus); in xhci_start_controller()
445 if (sc->sc_port_route != NULL) { in xhci_start_controller()
447 sc->sc_port_route(sc->sc_bus.parent, in xhci_start_controller()
461 sc->sc_capa_off = 0; in xhci_halt_controller()
462 sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); in xhci_halt_controller()
463 sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0xF; in xhci_halt_controller()
464 sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; in xhci_halt_controller()
477 device_printf(sc->sc_bus.parent, "Controller halt timeout.\n"); in xhci_halt_controller()
503 device_printf(sc->sc_bus.parent, "Controller " in xhci_reset_controller()
518 sc->sc_bus.parent = self; in xhci_init()
521 sc->sc_bus.usbrev = USB_REV_3_0; in xhci_init()
524 sc->sc_bus.methods = &xhci_bus_methods; in xhci_init()
527 sc->sc_bus.devices = sc->sc_devices; in xhci_init()
528 sc->sc_bus.devices_max = XHCI_MAX_DEVICES; in xhci_init()
531 sc->sc_event_ccs = 1; in xhci_init()
532 sc->sc_command_ccs = 1; in xhci_init()
535 sc->sc_capa_off = 0; in xhci_init()
536 sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); in xhci_init()
537 sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0x1F; in xhci_init()
538 sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; in xhci_init()
540 DPRINTF("CAPLENGTH=0x%x\n", sc->sc_oper_off); in xhci_init()
541 DPRINTF("RUNTIMEOFFSET=0x%x\n", sc->sc_runt_off); in xhci_init()
542 DPRINTF("DOOROFFSET=0x%x\n", sc->sc_door_off); in xhci_init()
547 device_printf(sc->sc_bus.parent, "Controller does " in xhci_init()
558 sc->sc_ctx_is_64_byte = 1; in xhci_init()
560 sc->sc_ctx_is_64_byte = 0; in xhci_init()
564 sc->sc_bus.dma_bits = (XHCI_HCS0_AC64(temp) && in xhci_init()
567 device_printf(self, "%d bytes context size, %d-bit DMA\n", in xhci_init()
568 sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); in xhci_init()
573 sc->sc_bus.control_ep_quirk = (xhcictlquirk ? 1 : 0); in xhci_init()
578 sc->sc_noport = XHCI_HCS1_N_PORTS(temp); in xhci_init()
580 if (sc->sc_noport == 0) { in xhci_init()
581 device_printf(sc->sc_bus.parent, "Invalid number " in xhci_init()
582 "of ports: %u\n", sc->sc_noport); in xhci_init()
586 sc->sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp); in xhci_init()
588 DPRINTF("Max slots: %u\n", sc->sc_noslot); in xhci_init()
590 if (sc->sc_noslot > XHCI_MAX_DEVICES) in xhci_init()
591 sc->sc_noslot = XHCI_MAX_DEVICES; in xhci_init()
598 sc->sc_ist = XHCI_HCS2_IST(temp); in xhci_init()
601 sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); in xhci_init()
603 if (sc->sc_noscratch > XHCI_MAX_SCRATCHPADS) { in xhci_init()
604 device_printf(sc->sc_bus.parent, "XHCI request " in xhci_init()
609 DPRINTF("Max scratch: %u\n", sc->sc_noscratch); in xhci_init()
612 sc->sc_erst_max = 1U << XHCI_HCS2_ERST_MAX(temp); in xhci_init()
613 if (sc->sc_erst_max > XHCI_MAX_RSEG) in xhci_init()
614 sc->sc_erst_max = XHCI_MAX_RSEG; in xhci_init()
619 sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + in xhci_init()
623 if (sc->sc_imod_default == 0) in xhci_init()
624 sc->sc_imod_default = XHCI_IMOD_DEFAULT; in xhci_init()
627 if (usb_bus_mem_alloc_all(&sc->sc_bus, in xhci_init()
633 cv_init(&sc->sc_cmd_cv, "CMDQ"); in xhci_init()
634 sx_init(&sc->sc_cmd_sx, "CMDQ lock"); in xhci_init()
636 sc->sc_config_msg[0].hdr.pm_callback = &xhci_configure_msg; in xhci_init()
637 sc->sc_config_msg[0].bus = &sc->sc_bus; in xhci_init()
638 sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg; in xhci_init()
639 sc->sc_config_msg[1].bus = &sc->sc_bus; in xhci_init()
653 usb_bus_mem_free_all(&sc->sc_bus, &xhci_iterate_hw_softc); in xhci_uninit()
655 cv_destroy(&sc->sc_cmd_cv); in xhci_uninit()
656 sx_destroy(&sc->sc_cmd_sx); in xhci_uninit()
671 device_printf(sc->sc_bus.parent, in xhci_get_xecp()
682 device_printf(sc->sc_bus.parent, "xECP capabilities <"); in xhci_get_xecp()
684 eec = -1; in xhci_get_xecp()
774 td = xfer->td_transfer_cache; in xhci_generic_done_sub()
775 td_alt_next = td->alt_next; in xhci_generic_done_sub()
777 if (xfer->aframes != xfer->nframes) in xhci_generic_done_sub()
778 usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); in xhci_generic_done_sub()
781 usb_pc_cpu_invalidate(td->page_cache); in xhci_generic_done_sub()
783 status = td->status; in xhci_generic_done_sub()
784 len = td->remainder; in xhci_generic_done_sub()
787 xfer, (unsigned)xfer->aframes, in xhci_generic_done_sub()
788 (unsigned)xfer->nframes, in xhci_generic_done_sub()
789 (unsigned)len, (unsigned)td->len, in xhci_generic_done_sub()
796 if (len > td->len) { in xhci_generic_done_sub()
799 "0x%04x/0x%04x bytes\n", len, td->len); in xhci_generic_done_sub()
801 } else if (xfer->aframes != xfer->nframes) { in xhci_generic_done_sub()
802 xfer->frlengths[xfer->aframes] += td->len - len; in xhci_generic_done_sub()
805 if (((void *)td) == xfer->td_transfer_last) { in xhci_generic_done_sub()
818 if (xfer->flags_int.short_frames_ok || in xhci_generic_done_sub()
819 xfer->flags_int.isochronous_xfr || in xhci_generic_done_sub()
820 xfer->flags_int.control_xfr) { in xhci_generic_done_sub()
822 td = td->alt_next; in xhci_generic_done_sub()
829 td = td->obj_next; in xhci_generic_done_sub()
831 if (td->alt_next != td_alt_next) { in xhci_generic_done_sub()
839 xfer->td_transfer_cache = td; in xhci_generic_done_sub()
853 xfer, xfer->endpoint); in xhci_generic_done()
857 xfer->td_transfer_cache = xfer->td_transfer_first; in xhci_generic_done()
859 if (xfer->flags_int.control_xfr) { in xhci_generic_done()
860 if (xfer->flags_int.control_hdr) in xhci_generic_done()
863 xfer->aframes = 1; in xhci_generic_done()
865 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
869 while (xfer->aframes != xfer->nframes) { in xhci_generic_done()
871 xfer->aframes++; in xhci_generic_done()
873 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
877 if (xfer->flags_int.control_xfr && in xhci_generic_done()
878 !xfer->flags_int.control_act) in xhci_generic_done()
890 td = xfer->td_transfer_cache; in xhci_activate_transfer()
892 usb_pc_cpu_invalidate(td->page_cache); in xhci_activate_transfer()
894 if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { in xhci_activate_transfer()
897 td->td_trb[0].dwTrb3 |= htole32(XHCI_TRB_3_CYCLE_BIT); in xhci_activate_transfer()
898 usb_pc_cpu_flush(td->page_cache); in xhci_activate_transfer()
910 td = xfer->td_transfer_cache; in xhci_skip_transfer()
911 td_last = xfer->td_transfer_last; in xhci_skip_transfer()
913 td = td->alt_next; in xhci_skip_transfer()
915 usb_pc_cpu_invalidate(td->page_cache); in xhci_skip_transfer()
917 if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { in xhci_skip_transfer()
918 usb_pc_cpu_invalidate(td_last->page_cache); in xhci_skip_transfer()
922 td->td_trb[0].qwTrb0 = td_last->td_trb[td_last->ntrb].qwTrb0; in xhci_skip_transfer()
923 td->td_trb[0].dwTrb2 = td_last->td_trb[td_last->ntrb].dwTrb2; in xhci_skip_transfer()
924 usb_pc_cpu_flush(td->page_cache); in xhci_skip_transfer()
926 td->td_trb[0].dwTrb3 = td_last->td_trb[td_last->ntrb].dwTrb3; in xhci_skip_transfer()
927 usb_pc_cpu_flush(td->page_cache); in xhci_skip_transfer()
933 /*------------------------------------------------------------------------*
935 *------------------------------------------------------------------------*/
952 td_event = le64toh(trb->qwTrb0); in xhci_check_transfer()
953 temp = le32toh(trb->dwTrb2); in xhci_check_transfer()
958 temp = le32toh(trb->dwTrb3); in xhci_check_transfer()
969 if (index > sc->sc_noslot) { in xhci_check_transfer()
979 pepext = &sc->sc_hw.devs[index].endp[epno]; in xhci_check_transfer()
986 if (i == (XHCI_MAX_TRANSFERS - 1)) { in xhci_check_transfer()
987 if (pepext->trb_ep_mode != USB_EP_MODE_STREAMS || in xhci_check_transfer()
988 stream_id == (XHCI_MAX_STREAMS - 1)) in xhci_check_transfer()
995 xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; in xhci_check_transfer()
999 td = xfer->td_transfer_cache; in xhci_check_transfer()
1003 (long long)td->td_self, in xhci_check_transfer()
1004 (long long)td->td_self + sizeof(td->td_trb)); in xhci_check_transfer()
1016 offset = td_event - td->td_self; in xhci_check_transfer()
1019 offset < (int64_t)sizeof(td->td_trb)) { in xhci_check_transfer()
1020 usb_pc_cpu_invalidate(td->page_cache); in xhci_check_transfer()
1023 for (i = (offset / 16) + 1; i < td->ntrb; i++) { in xhci_check_transfer()
1024 temp = le32toh(td->td_trb[i].dwTrb2); in xhci_check_transfer()
1031 if (xfer->flags_int.isochronous_xfr) { in xhci_check_transfer()
1035 remainder = td->len; in xhci_check_transfer()
1039 /* "td->remainder" is verified later */ in xhci_check_transfer()
1040 td->remainder = remainder; in xhci_check_transfer()
1041 td->status = status; in xhci_check_transfer()
1043 usb_pc_cpu_flush(td->page_cache); in xhci_check_transfer()
1049 if (((void *)td) == xfer->td_transfer_last) { in xhci_check_transfer()
1060 DPRINTF("TD has I/O error\n"); in xhci_check_transfer()
1069 if (td->remainder > 0) { in xhci_check_transfer()
1070 if (td->alt_next == NULL) { in xhci_check_transfer()
1072 "short TD has no alternate next\n"); in xhci_check_transfer()
1076 DPRINTF("TD has short pkt\n"); in xhci_check_transfer()
1077 if (xfer->flags_int.short_frames_ok || in xhci_check_transfer()
1078 xfer->flags_int.isochronous_xfr || in xhci_check_transfer()
1079 xfer->flags_int.control_xfr) { in xhci_check_transfer()
1081 xfer->td_transfer_cache = td->alt_next; in xhci_check_transfer()
1091 * 4) Transfer complete - go to next TD in xhci_check_transfer()
1094 xfer->td_transfer_cache = td->obj_next; in xhci_check_transfer()
1104 if (sc->sc_cmd_addr == trb->qwTrb0) { in xhci_check_command()
1106 sc->sc_cmd_result[0] = trb->dwTrb2; in xhci_check_command()
1107 sc->sc_cmd_result[1] = trb->dwTrb3; in xhci_check_command()
1108 cv_signal(&sc->sc_cmd_cv); in xhci_check_command()
1128 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_interrupt_poll()
1134 usb_pc_cpu_invalidate(&sc->sc_hw.root_pc); in xhci_interrupt_poll()
1136 i = sc->sc_event_idx; in xhci_interrupt_poll()
1137 j = sc->sc_event_ccs; in xhci_interrupt_poll()
1141 temp = le32toh(phwr->hwr_events[i].dwTrb3); in xhci_interrupt_poll()
1151 i, event, (long long)le64toh(phwr->hwr_events[i].qwTrb0), in xhci_interrupt_poll()
1152 (long)le32toh(phwr->hwr_events[i].dwTrb2), in xhci_interrupt_poll()
1153 (long)le32toh(phwr->hwr_events[i].dwTrb3)); in xhci_interrupt_poll()
1157 xhci_check_transfer(sc, &phwr->hwr_events[i]); in xhci_interrupt_poll()
1160 retval |= xhci_check_command(sc, &phwr->hwr_events[i]); in xhci_interrupt_poll()
1174 if (!--t) in xhci_interrupt_poll()
1179 sc->sc_event_idx = i; in xhci_interrupt_poll()
1180 sc->sc_event_ccs = j; in xhci_interrupt_poll()
1183 * NOTE: The Event Ring Dequeue Pointer Register is 64-bit in xhci_interrupt_poll()
1185 * write both the low and high double word of the 64-bit in xhci_interrupt_poll()
1218 usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); in xhci_do_command()
1224 USB_BUS_LOCK(&sc->sc_bus); in xhci_do_command()
1226 i = sc->sc_command_idx; in xhci_do_command()
1227 j = sc->sc_command_ccs; in xhci_do_command()
1230 i, XHCI_TRB_3_TYPE_GET(le32toh(trb->dwTrb3)), in xhci_do_command()
1231 (long long)le64toh(trb->qwTrb0), in xhci_do_command()
1232 (long)le32toh(trb->dwTrb2), in xhci_do_command()
1233 (long)le32toh(trb->dwTrb3)); in xhci_do_command()
1235 phwr->hwr_commands[i].qwTrb0 = trb->qwTrb0; in xhci_do_command()
1236 phwr->hwr_commands[i].dwTrb2 = trb->dwTrb2; in xhci_do_command()
1238 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1240 temp = trb->dwTrb3; in xhci_do_command()
1249 phwr->hwr_commands[i].dwTrb3 = temp; in xhci_do_command()
1251 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1256 sc->sc_cmd_addr = htole64(addr); in xhci_do_command()
1260 if (i == (XHCI_MAX_COMMANDS - 1)) { in xhci_do_command()
1270 phwr->hwr_commands[i].dwTrb3 = temp; in xhci_do_command()
1272 usb_pc_cpu_flush(&sc->sc_hw.root_pc); in xhci_do_command()
1278 sc->sc_command_idx = i; in xhci_do_command()
1279 sc->sc_command_ccs = j; in xhci_do_command()
1283 err = cv_timedwait(&sc->sc_cmd_cv, &sc->sc_bus.bus_mtx, in xhci_do_command()
1288 * Poll one time to see if the command has completed. in xhci_do_command()
1297 * After some weeks of continuous operation, it has in xhci_do_command()
1306 temp = le32toh(trb->dwTrb3); in xhci_do_command()
1311 * non-enumerating device: in xhci_do_command()
1322 usb_bus_reset_async_locked(&sc->sc_bus); in xhci_do_command()
1325 trb->dwTrb2 = 0; in xhci_do_command()
1326 trb->dwTrb3 = 0; in xhci_do_command()
1328 temp = le32toh(sc->sc_cmd_result[0]); in xhci_do_command()
1332 trb->dwTrb2 = sc->sc_cmd_result[0]; in xhci_do_command()
1333 trb->dwTrb3 = sc->sc_cmd_result[1]; in xhci_do_command()
1336 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_do_command()
1430 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_set_address()
1440 if (udev->parent_hub == NULL) in xhci_set_address()
1443 index = udev->controller_slot_id; in xhci_set_address()
1445 hdev = &sc->sc_hw.devs[index]; in xhci_set_address()
1452 switch (hdev->state) { in xhci_set_address()
1456 hdev->state = XHCI_ST_ENABLED; in xhci_set_address()
1470 switch (udev->speed) { in xhci_set_address()
1484 &udev->ctrl_ep_desc); in xhci_set_address()
1487 USB_BUS_LOCK(udev->bus); in xhci_set_address()
1488 pepext->trb_halted = 1; in xhci_set_address()
1489 pepext->trb_running = 0; in xhci_set_address()
1490 USB_BUS_UNLOCK(udev->bus); in xhci_set_address()
1493 &udev->ctrl_ep_desc, pepext, in xhci_set_address()
1502 usbd_get_page(&hdev->input_pc, 0, &buf_inp); in xhci_set_address()
1508 temp = le32toh(sc->sc_cmd_result[0]); in xhci_set_address()
1509 if (address == 0 && sc->sc_port_route != NULL && in xhci_set_address()
1512 /* LynxPoint XHCI - ports are not switchable */ in xhci_set_address()
1513 /* Un-route all ports from the XHCI */ in xhci_set_address()
1514 sc->sc_port_route(sc->sc_bus.parent, 0, ~0); in xhci_set_address()
1524 usbd_get_page(&hdev->device_pc, 0, &buf_dev); in xhci_set_address()
1527 usb_pc_cpu_invalidate(&hdev->device_pc); in xhci_set_address()
1529 temp = le32toh(slot->dwSctx3); in xhci_set_address()
1530 udev->address = XHCI_SCTX_3_DEV_ADDR_GET(temp); in xhci_set_address()
1535 hdev->state = XHCI_ST_ADDRESSED; in xhci_set_address()
1537 hdev->state = XHCI_ST_DEFAULT; in xhci_set_address()
1568 if (sc->sc_no_deconfigure != 0 || xhcidcepquirk != 0) in xhci_cmd_configure_ep()
1682 /*------------------------------------------------------------------------*
1683 * xhci_interrupt - XHCI interrupt handler
1684 *------------------------------------------------------------------------*/
1691 USB_BUS_LOCK(&sc->sc_bus); in xhci_interrupt()
1731 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_interrupt()
1734 /*------------------------------------------------------------------------*
1735 * xhci_timeout - XHCI timeout handler
1736 *------------------------------------------------------------------------*/
1744 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in xhci_timeout()
1755 USB_BUS_LOCK(&sc->sc_bus); in xhci_do_poll()
1757 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_do_poll()
1779 shortpkt_old = temp->shortpkt; in xhci_setup_generic_chain_sub()
1780 len_old = temp->len; in xhci_setup_generic_chain_sub()
1786 td = temp->td; in xhci_setup_generic_chain_sub()
1787 td_next = td_first = temp->td_next; in xhci_setup_generic_chain_sub()
1790 if (temp->len == 0) { in xhci_setup_generic_chain_sub()
1791 if (temp->shortpkt) in xhci_setup_generic_chain_sub()
1796 temp->shortpkt = 1; in xhci_setup_generic_chain_sub()
1800 average = temp->average; in xhci_setup_generic_chain_sub()
1802 if (temp->len < average) { in xhci_setup_generic_chain_sub()
1803 if (temp->len % temp->max_packet_size) { in xhci_setup_generic_chain_sub()
1804 temp->shortpkt = 1; in xhci_setup_generic_chain_sub()
1806 average = temp->len; in xhci_setup_generic_chain_sub()
1816 td_next = td->obj_next; in xhci_setup_generic_chain_sub()
1818 /* check if we are pre-computing */ in xhci_setup_generic_chain_sub()
1823 temp->len -= average; in xhci_setup_generic_chain_sub()
1829 td->len = average; in xhci_setup_generic_chain_sub()
1830 td->remainder = 0; in xhci_setup_generic_chain_sub()
1831 td->status = 0; in xhci_setup_generic_chain_sub()
1835 temp->len -= average; in xhci_setup_generic_chain_sub()
1841 if (temp->trb_type == XHCI_TRB_TYPE_SETUP_STAGE) { in xhci_setup_generic_chain_sub()
1847 td->td_trb[0].qwTrb0 = 0; in xhci_setup_generic_chain_sub()
1849 usbd_copy_out(temp->pc, temp->offset + buf_offset, in xhci_setup_generic_chain_sub()
1850 (uint8_t *)(uintptr_t)&td->td_trb[0].qwTrb0, in xhci_setup_generic_chain_sub()
1857 td->td_trb[0].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
1863 if (td->td_trb[0].qwTrb0 & in xhci_setup_generic_chain_sub()
1865 if (td->td_trb[0].qwTrb0 & in xhci_setup_generic_chain_sub()
1872 td->td_trb[0].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
1874 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
1886 usbd_get_page(temp->pc, temp->offset + in xhci_setup_generic_chain_sub()
1901 npkt = howmany(len_old - npkt_off, in xhci_setup_generic_chain_sub()
1902 temp->max_packet_size); in xhci_setup_generic_chain_sub()
1910 td->td_trb[x].qwTrb0 = in xhci_setup_generic_chain_sub()
1918 td->td_trb[x].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
1920 switch (temp->trb_type) { in xhci_setup_generic_chain_sub()
1923 XHCI_TRB_3_TBC_SET(temp->tbc) | in xhci_setup_generic_chain_sub()
1924 XHCI_TRB_3_TLBPC_SET(temp->tlbpc); in xhci_setup_generic_chain_sub()
1927 } else if (temp->do_isoc_sync != 0) { in xhci_setup_generic_chain_sub()
1928 temp->do_isoc_sync = 0; in xhci_setup_generic_chain_sub()
1931 XHCI_TRB_3_FRID_SET(temp->isoc_frame / 8); in xhci_setup_generic_chain_sub()
1937 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1943 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1949 * normal-TRB if there are more TRBs in xhci_setup_generic_chain_sub()
1950 * extending the data-stage in xhci_setup_generic_chain_sub()
1953 temp->trb_type = XHCI_TRB_TYPE_NORMAL; in xhci_setup_generic_chain_sub()
1958 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1964 if (temp->direction == UE_DIR_IN) in xhci_setup_generic_chain_sub()
1968 td->td_trb[x].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
1970 average -= buf_res.length; in xhci_setup_generic_chain_sub()
1973 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
1979 td->td_trb[x-1].dwTrb3 |= htole32(XHCI_TRB_3_IOC_BIT); in xhci_setup_generic_chain_sub()
1983 td->ntrb = x; in xhci_setup_generic_chain_sub()
1991 td->td_trb[x].qwTrb0 = htole64((uint64_t)td_next->td_self); in xhci_setup_generic_chain_sub()
1992 DPRINTF("LINK=0x%08llx\n", (long long)td_next->td_self); in xhci_setup_generic_chain_sub()
2000 td->td_trb[x].dwTrb2 = htole32(dword); in xhci_setup_generic_chain_sub()
2005 * CHAIN-BIT: Ensure that a multi-TRB IN-endpoint in xhci_setup_generic_chain_sub()
2009 * sending a ZLP unless the CHAIN-BIT is set in in xhci_setup_generic_chain_sub()
2014 td->td_trb[x].dwTrb3 = htole32(dword); in xhci_setup_generic_chain_sub()
2016 td->alt_next = td_alt_next; in xhci_setup_generic_chain_sub()
2018 xhci_dump_trb(&td->td_trb[x]); in xhci_setup_generic_chain_sub()
2020 usb_pc_cpu_flush(td->page_cache); in xhci_setup_generic_chain_sub()
2027 if (temp->last_frame) { in xhci_setup_generic_chain_sub()
2035 temp->shortpkt = shortpkt_old; in xhci_setup_generic_chain_sub()
2036 temp->len = len_old; in xhci_setup_generic_chain_sub()
2044 if (temp->step_td != 0) { in xhci_setup_generic_chain_sub()
2045 td_first->td_trb[0].dwTrb3 &= ~htole32(XHCI_TRB_3_CYCLE_BIT); in xhci_setup_generic_chain_sub()
2046 usb_pc_cpu_flush(td_first->page_cache); in xhci_setup_generic_chain_sub()
2051 td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(31)); in xhci_setup_generic_chain_sub()
2052 td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); in xhci_setup_generic_chain_sub()
2053 /* remove CHAIN-BIT from last LINK TRB */ in xhci_setup_generic_chain_sub()
2054 td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); in xhci_setup_generic_chain_sub()
2056 usb_pc_cpu_flush(td->page_cache); in xhci_setup_generic_chain_sub()
2058 temp->td = td; in xhci_setup_generic_chain_sub()
2059 temp->td_next = td_next; in xhci_setup_generic_chain_sub()
2075 temp.average = xfer->max_hc_frame_size; in xhci_setup_generic_chain()
2076 temp.max_packet_size = xfer->max_packet_size; in xhci_setup_generic_chain()
2077 temp.sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_setup_generic_chain()
2081 temp.multishort = xfer->flags_int.isochronous_xfr || in xhci_setup_generic_chain()
2082 xfer->flags_int.control_xfr || in xhci_setup_generic_chain()
2083 xfer->flags_int.short_frames_ok; in xhci_setup_generic_chain()
2086 xfer->flags_int.curr_dma_set ^= 1; in xhci_setup_generic_chain()
2089 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in xhci_setup_generic_chain()
2094 xfer->td_transfer_first = td; in xhci_setup_generic_chain()
2095 xfer->td_transfer_cache = td; in xhci_setup_generic_chain()
2097 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2101 mult = xfer->endpoint->ecomp ? in xhci_setup_generic_chain()
2102 UE_GET_SS_ISO_MULT(xfer->endpoint->ecomp->bmAttributes) in xhci_setup_generic_chain()
2106 mult = (xfer->endpoint->edesc-> in xhci_setup_generic_chain()
2117 DPRINTF("MFINDEX=0x%08x IST=0x%x\n", x, temp.sc->sc_ist); in xhci_setup_generic_chain()
2119 switch (usbd_get_speed(xfer->xroot->udev)) { in xhci_setup_generic_chain()
2131 if (temp.sc->sc_ist & 8) in xhci_setup_generic_chain()
2132 y = (temp.sc->sc_ist & 7) << 3; in xhci_setup_generic_chain()
2134 y = (temp.sc->sc_ist & 7); in xhci_setup_generic_chain()
2140 DPRINTFN(3, "IST(%d) is too big!\n", temp.sc->sc_ist); in xhci_setup_generic_chain()
2155 y -= 8; in xhci_setup_generic_chain()
2159 xfer, x, y, 8, XHCI_MFINDEX_GET(-1), &temp.isoc_frame)) { in xhci_setup_generic_chain()
2169 } else if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2172 if (xfer->flags_int.control_hdr) { in xhci_setup_generic_chain()
2173 temp.len = xfer->frlengths[0]; in xhci_setup_generic_chain()
2174 temp.pc = xfer->frbuffers + 0; in xhci_setup_generic_chain()
2180 if (xfer->nframes == 1) { in xhci_setup_generic_chain()
2182 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2192 temp.trb_type = xfer->flags_int.control_did_data ? in xhci_setup_generic_chain()
2202 if (x != xfer->nframes) { in xhci_setup_generic_chain()
2204 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2206 temp.direction = UE_GET_DIR(xfer->endpointno); in xhci_setup_generic_chain()
2209 while (x != xfer->nframes) { in xhci_setup_generic_chain()
2212 temp.len = xfer->frlengths[x]; in xhci_setup_generic_chain()
2213 temp.step_td = ((xfer->endpointno & UE_DIR_IN) && in xhci_setup_generic_chain()
2218 if (x == xfer->nframes) { in xhci_setup_generic_chain()
2219 if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2221 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2233 temp.tlbpc = mult - 1; in xhci_setup_generic_chain()
2235 } else if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2247 if (temp.len > xfer->max_frame_size) in xhci_setup_generic_chain()
2248 temp.len = xfer->max_frame_size; in xhci_setup_generic_chain()
2251 tdpc = howmany(temp.len, xfer->max_packet_size); in xhci_setup_generic_chain()
2253 temp.tbc = howmany(tdpc, mult) - 1; in xhci_setup_generic_chain()
2257 temp.tlbpc = mult - 1; in xhci_setup_generic_chain()
2259 temp.tlbpc--; in xhci_setup_generic_chain()
2263 temp.shortpkt = xfer->flags.force_short_xfer ? 0 : 1; in xhci_setup_generic_chain()
2268 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2269 temp.offset += xfer->frlengths[x - 1]; in xhci_setup_generic_chain()
2273 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2279 if (xfer->flags_int.control_xfr && in xhci_setup_generic_chain()
2280 !xfer->flags_int.control_act) { in xhci_setup_generic_chain()
2285 if (xhcictlstep || temp.sc->sc_ctlstep) { in xhci_setup_generic_chain()
2292 temp.step_td = (xfer->nframes != 0); in xhci_setup_generic_chain()
2296 temp.direction = UE_GET_DIR(xfer->endpointno) ^ UE_DIR_IN; in xhci_setup_generic_chain()
2310 xfer->td_transfer_last = td; in xhci_setup_generic_chain()
2312 DPRINTF("first=%p last=%p\n", xfer->td_transfer_first, td); in xhci_setup_generic_chain()
2321 usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res); in xhci_set_slot_pointer()
2327 pdctxa->qwBaaDevCtxAddr[index] = htole64(dev_addr); in xhci_set_slot_pointer()
2329 usb_pc_cpu_flush(&sc->sc_hw.ctx_pc); in xhci_set_slot_pointer()
2335 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_mask()
2343 index = udev->controller_slot_id; in xhci_configure_mask()
2345 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_configure_mask()
2353 input->dwInCtx0 = htole32(mask); in xhci_configure_mask()
2354 input->dwInCtx1 = htole32(0); in xhci_configure_mask()
2360 input->dwInCtx0 = htole32(mask & XHCI_INCTX_NON_CTRL_MASK); in xhci_configure_mask()
2363 input->dwInCtx1 = htole32(mask); in xhci_configure_mask()
2366 for (x = 31; x != 1; x--) { in xhci_configure_mask()
2372 x--; in xhci_configure_mask()
2375 if (x > sc->sc_hw.devs[index].context_num) in xhci_configure_mask()
2376 sc->sc_hw.devs[index].context_num = x; in xhci_configure_mask()
2378 x = sc->sc_hw.devs[index].context_num; in xhci_configure_mask()
2381 temp = le32toh(slot->dwSctx0); in xhci_configure_mask()
2384 slot->dwSctx0 = htole32(temp); in xhci_configure_mask()
2386 usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); in xhci_configure_mask()
2398 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_endpoint()
2400 uint64_t ring_addr = pepext->physaddr; in xhci_configure_endpoint()
2406 index = udev->controller_slot_id; in xhci_configure_endpoint()
2408 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_configure_endpoint()
2410 epno = edesc->bEndpointAddress; in xhci_configure_endpoint()
2411 type = edesc->bmAttributes & UE_XFERTYPE; in xhci_configure_endpoint()
2424 max_packet_count--; in xhci_configure_endpoint()
2429 endp = XHCI_GET_CTX(sc, xhci_input_dev_ctx, ctx_ep[epno - 1], in xhci_configure_endpoint()
2433 pepext->trb_ep_mode = ep_mode; in xhci_configure_endpoint()
2435 pepext->trb_ep_maxp = edesc->wMaxPacketSize[0]; in xhci_configure_endpoint()
2436 usb_pc_cpu_flush(pepext->page_cache); in xhci_configure_endpoint()
2440 XHCI_EPCTX_0_MAXP_STREAMS_SET(XHCI_MAX_STREAMS_LOG - 1) | in xhci_configure_endpoint()
2453 switch (udev->speed) { in xhci_configure_endpoint()
2456 /* 1ms -> 125us */ in xhci_configure_endpoint()
2466 fps_shift--; in xhci_configure_endpoint()
2472 switch (udev->speed) { in xhci_configure_endpoint()
2476 temp |= XHCI_EPCTX_0_MULT_SET(mult - 1); in xhci_configure_endpoint()
2487 endp->dwEpCtx0 = htole32(temp); in xhci_configure_endpoint()
2522 endp->dwEpCtx1 = htole32(temp); in xhci_configure_endpoint()
2523 endp->qwEpCtx2 = htole64(ring_addr); in xhci_configure_endpoint()
2525 switch (edesc->bmAttributes & UE_XFERTYPE) { in xhci_configure_endpoint()
2540 endp->dwEpCtx4 = htole32(temp); in xhci_configure_endpoint()
2545 usb_pc_cpu_flush(&sc->sc_hw.devs[index].input_pc); in xhci_configure_endpoint()
2557 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2558 xfer->endpoint->edesc); in xhci_configure_endpoint_by_xfer()
2560 ecomp = xfer->endpoint->ecomp; in xhci_configure_endpoint_by_xfer()
2566 pepext->trb[x * XHCI_MAX_TRANSFERS].dwTrb3 = 0; in xhci_configure_endpoint_by_xfer()
2569 temp = pepext->physaddr + in xhci_configure_endpoint_by_xfer()
2574 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2578 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2580 pepext->trb[(XHCI_MAX_TRANSFERS * in xhci_configure_endpoint_by_xfer()
2583 usb_pc_cpu_flush(pepext->page_cache); in xhci_configure_endpoint_by_xfer()
2585 return (xhci_configure_endpoint(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2586 xfer->endpoint->edesc, pepext, in xhci_configure_endpoint_by_xfer()
2587 xfer->interval, xfer->max_packet_count, in xhci_configure_endpoint_by_xfer()
2588 (ecomp != NULL) ? UE_GET_SS_ISO_MULT(ecomp->bmAttributes) + 1 : 1, in xhci_configure_endpoint_by_xfer()
2589 usbd_xfer_get_fps_shift(xfer), xfer->max_packet_size, in xhci_configure_endpoint_by_xfer()
2590 xfer->max_frame_size, xfer->endpoint->ep_mode)); in xhci_configure_endpoint_by_xfer()
2596 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_configure_device()
2608 index = udev->controller_slot_id; in xhci_configure_device()
2612 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_configure_device()
2623 for (hubdev = udev; hubdev != NULL; hubdev = hubdev->parent_hub) { in xhci_configure_device()
2624 if (hubdev->parent_hub == NULL) in xhci_configure_device()
2627 depth = hubdev->parent_hub->depth; in xhci_configure_device()
2634 rh_port = hubdev->port_no; in xhci_configure_device()
2643 route |= rh_port << (4 * (depth - 1)); in xhci_configure_device()
2650 sc->sc_hw.devs[index].context_num + 1); in xhci_configure_device()
2652 switch (udev->speed) { in xhci_configure_device()
2655 if (udev->parent_hs_hub != NULL && in xhci_configure_device()
2656 udev->parent_hs_hub->ddesc.bDeviceProtocol == in xhci_configure_device()
2664 if (sc->sc_hw.devs[index].nports != 0 && in xhci_configure_device()
2665 udev->ddesc.bDeviceProtocol == UDPROTO_HSHUBMTT) { in xhci_configure_device()
2672 if (udev->parent_hs_hub != NULL && in xhci_configure_device()
2673 udev->parent_hs_hub->ddesc.bDeviceProtocol == in xhci_configure_device()
2684 is_hub = sc->sc_hw.devs[index].nports != 0 && in xhci_configure_device()
2685 (udev->speed == USB_SPEED_SUPER || in xhci_configure_device()
2686 udev->speed == USB_SPEED_HIGH); in xhci_configure_device()
2691 slot->dwSctx0 = htole32(temp); in xhci_configure_device()
2697 sc->sc_hw.devs[index].nports); in xhci_configure_device()
2700 slot->dwSctx1 = htole32(temp); in xhci_configure_device()
2706 sc->sc_hw.devs[index].tt); in xhci_configure_device()
2709 hubdev = udev->parent_hs_hub; in xhci_configure_device()
2711 /* check if we should activate the transaction translator */ in xhci_configure_device()
2712 switch (udev->speed) { in xhci_configure_device()
2717 hubdev->controller_slot_id); in xhci_configure_device()
2719 udev->hs_port_no); in xhci_configure_device()
2726 slot->dwSctx2 = htole32(temp); in xhci_configure_device()
2730 * XHCI section 6.2.2 - slot context: in xhci_configure_device()
2735 slot->dwSctx3 = htole32(temp); in xhci_configure_device()
2748 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_alloc_device_ext()
2758 index = udev->controller_slot_id; in xhci_alloc_device_ext()
2760 pc = &sc->sc_hw.devs[index].device_pc; in xhci_alloc_device_ext()
2761 pg = &sc->sc_hw.devs[index].device_pg; in xhci_alloc_device_ext()
2764 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2766 if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? in xhci_alloc_device_ext()
2773 pc = &sc->sc_hw.devs[index].input_pc; in xhci_alloc_device_ext()
2774 pg = &sc->sc_hw.devs[index].input_pg; in xhci_alloc_device_ext()
2777 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2779 if (usb_pc_alloc_mem(pc, pg, sc->sc_ctx_is_64_byte ? in xhci_alloc_device_ext()
2788 pc = &sc->sc_hw.devs[index].endpoint_pc[i]; in xhci_alloc_device_ext()
2789 pg = &sc->sc_hw.devs[index].endpoint_pg[i]; in xhci_alloc_device_ext()
2792 pc->tag_parent = sc->sc_bus.dma_parent_tag; in xhci_alloc_device_ext()
2804 trb += XHCI_MAX_TRANSFERS - 1; in xhci_alloc_device_ext()
2810 trb->qwTrb0 = htole64(addr); in xhci_alloc_device_ext()
2811 trb->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_alloc_device_ext()
2812 trb->dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT | in xhci_alloc_device_ext()
2831 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_free_device_ext()
2835 index = udev->controller_slot_id; in xhci_free_device_ext()
2838 usb_pc_free_mem(&sc->sc_hw.devs[index].device_pc); in xhci_free_device_ext()
2839 usb_pc_free_mem(&sc->sc_hw.devs[index].input_pc); in xhci_free_device_ext()
2841 usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc[i]); in xhci_free_device_ext()
2847 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_get_endpoint_ext()
2854 epno = edesc->bEndpointAddress; in xhci_get_endpoint_ext()
2855 if ((edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) in xhci_get_endpoint_ext()
2860 index = udev->controller_slot_id; in xhci_get_endpoint_ext()
2862 pc = &sc->sc_hw.devs[index].endpoint_pc[epno]; in xhci_get_endpoint_ext()
2866 pepext = &sc->sc_hw.devs[index].endp[epno]; in xhci_get_endpoint_ext()
2867 pepext->page_cache = pc; in xhci_get_endpoint_ext()
2868 pepext->trb = buf_ep.buffer; in xhci_get_endpoint_ext()
2869 pepext->physaddr = buf_ep.physaddr; in xhci_get_endpoint_ext()
2877 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_endpoint_doorbell()
2881 epno = xfer->endpointno; in xhci_endpoint_doorbell()
2882 if (xfer->flags_int.control_xfr) in xhci_endpoint_doorbell()
2886 index = xfer->xroot->udev->controller_slot_id; in xhci_endpoint_doorbell()
2888 if (xfer->xroot->udev->flags.self_suspended == 0) { in xhci_endpoint_doorbell()
2890 epno | XHCI_DB_SID_SET(xfer->stream_id)); in xhci_endpoint_doorbell()
2899 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_remove()
2900 xfer->flags_int.bandwidth_reclaimed = 0; in xhci_transfer_remove()
2902 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_remove()
2903 xfer->endpoint->edesc); in xhci_transfer_remove()
2905 pepext->trb_used[xfer->stream_id]--; in xhci_transfer_remove()
2907 pepext->xfer[xfer->qh_pos] = NULL; in xhci_transfer_remove()
2909 if (error && pepext->trb_running != 0) { in xhci_transfer_remove()
2910 pepext->trb_halted = 1; in xhci_transfer_remove()
2911 pepext->trb_running = 0; in xhci_transfer_remove()
2931 id = xfer->stream_id; in xhci_transfer_insert()
2934 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_insert()
2939 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_insert()
2940 xfer->endpoint->edesc); in xhci_transfer_insert()
2942 td_first = xfer->td_transfer_first; in xhci_transfer_insert()
2943 td_last = xfer->td_transfer_last; in xhci_transfer_insert()
2944 addr = pepext->physaddr; in xhci_transfer_insert()
2946 switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) { in xhci_transfer_insert()
2954 trb_limit = (XHCI_MAX_TRANSFERS - 2); in xhci_transfer_insert()
2958 if (pepext->trb_used[id] >= trb_limit) { in xhci_transfer_insert()
2964 if (xfer->flags_int.control_xfr != 0 && in xhci_transfer_insert()
2965 pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { in xhci_transfer_insert()
2969 pepext->trb_halted = 1; in xhci_transfer_insert()
2970 pepext->trb_running = 0; in xhci_transfer_insert()
2974 if (pepext->trb_running == 0) { in xhci_transfer_insert()
2975 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_transfer_insert()
2980 (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), in xhci_transfer_insert()
2981 &sc->sc_config_msg[0], &sc->sc_config_msg[1]); in xhci_transfer_insert()
2985 pepext->trb_used[id]++; in xhci_transfer_insert()
2988 i = pepext->trb_index[id]; in xhci_transfer_insert()
2994 if (inext >= (XHCI_MAX_TRANSFERS - 1)) in xhci_transfer_insert()
2998 pepext->trb_index[id] = inext; in xhci_transfer_insert()
3008 trb_link = td_last->td_trb + td_last->ntrb; in xhci_transfer_insert()
3011 trb_link->qwTrb0 = htole64(addr); in xhci_transfer_insert()
3012 trb_link->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_transfer_insert()
3013 trb_link->dwTrb3 = htole32(XHCI_TRB_3_IOC_BIT | in xhci_transfer_insert()
3018 xhci_dump_trb(&td_last->td_trb[td_last->ntrb]); in xhci_transfer_insert()
3020 usb_pc_cpu_flush(td_last->page_cache); in xhci_transfer_insert()
3024 pepext->trb[inext].qwTrb0 = 0; in xhci_transfer_insert()
3025 pepext->trb[inext].dwTrb2 = 0; in xhci_transfer_insert()
3026 pepext->trb[inext].dwTrb3 = 0; in xhci_transfer_insert()
3030 pepext->trb[i].qwTrb0 = htole64((uint64_t)td_first->td_self); in xhci_transfer_insert()
3031 pepext->trb[i].dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0)); in xhci_transfer_insert()
3034 xhci_dump_trb(&pepext->trb[i]); in xhci_transfer_insert()
3036 usb_pc_cpu_flush(pepext->page_cache); in xhci_transfer_insert()
3040 pepext->trb[i].dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT | in xhci_transfer_insert()
3043 usb_pc_cpu_flush(pepext->page_cache); in xhci_transfer_insert()
3047 pepext->xfer[i] = xfer; in xhci_transfer_insert()
3049 xfer->qh_pos = i; in xhci_transfer_insert()
3051 xfer->flags_int.bandwidth_reclaimed = 1; in xhci_transfer_insert()
3063 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in xhci_root_intr()
3066 memset(sc->sc_hub_idata, 0, sizeof(sc->sc_hub_idata)); in xhci_root_intr()
3068 for (i = 1; i <= sc->sc_noport; i++) { in xhci_root_intr()
3075 sc->sc_hub_idata[i / 8] |= 1 << (i % 8); in xhci_root_intr()
3079 uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, in xhci_root_intr()
3080 sizeof(sc->sc_hub_idata)); in xhci_root_intr()
3083 /*------------------------------------------------------------------------*
3084 * xhci_device_done - XHCI done handler
3088 *------------------------------------------------------------------------*/
3093 xfer, xfer->endpoint, error); in xhci_device_done()
3102 /*------------------------------------------------------------------------*
3104 *------------------------------------------------------------------------*/
3126 xfer = ep->endpoint_q[stream_id].curr; in xhci_device_generic_multi_enter()
3135 if (!xfer->flags_int.bandwidth_reclaimed) in xhci_device_generic_multi_enter()
3138 xfer = TAILQ_FIRST(&ep->endpoint_q[stream_id].head); in xhci_device_generic_multi_enter()
3163 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_enter()
3164 xfer->stream_id, xfer); in xhci_device_generic_enter()
3176 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_start()
3177 xfer->stream_id, NULL); in xhci_device_generic_start()
3180 usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); in xhci_device_generic_start()
3183 if (xfer->timeout != 0) in xhci_device_generic_start()
3184 usbd_transfer_timeout_ms(xfer, &xhci_timeout, xfer->timeout); in xhci_device_generic_start()
3195 /*------------------------------------------------------------------------*
3197 *------------------------------------------------------------------------*
3199 *------------------------------------------------------------------------*/
3242 .bU1DevExitLat = 255, /* dummy - not used */
3300 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_roothub_exec()
3312 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in xhci_roothub_exec()
3315 ptr = (const void *)&sc->sc_hub_desc; in xhci_roothub_exec()
3319 value = UGETW(req->wValue); in xhci_roothub_exec()
3320 index = UGETW(req->wIndex); in xhci_roothub_exec()
3324 req->bmRequestType, req->bRequest, in xhci_roothub_exec()
3325 UGETW(req->wLength), value, index); in xhci_roothub_exec()
3328 switch (C(req->bRequest, req->bmRequestType)) { in xhci_roothub_exec()
3333 * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops in xhci_roothub_exec()
3339 sc->sc_hub_desc.temp[0] = sc->sc_conf; in xhci_roothub_exec()
3377 str_ptr = sc->sc_vendor; in xhci_roothub_exec()
3390 sc->sc_hub_desc.temp, in xhci_roothub_exec()
3391 sizeof(sc->sc_hub_desc.temp), in xhci_roothub_exec()
3402 sc->sc_hub_desc.temp[0] = 0; in xhci_roothub_exec()
3406 USETW(sc->sc_hub_desc.stat.wStatus, UDS_SELF_POWERED); in xhci_roothub_exec()
3411 USETW(sc->sc_hub_desc.stat.wStatus, 0); in xhci_roothub_exec()
3424 sc->sc_conf = value; in xhci_roothub_exec()
3444 (index > sc->sc_noport)) { in xhci_roothub_exec()
3478 if ((sc->sc_quirks & XHCI_QUIRK_DISABLE_PORT_PED) == 0) in xhci_roothub_exec()
3489 /* U3 -> U15 */ in xhci_roothub_exec()
3496 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 50); in xhci_roothub_exec()
3516 sc->sc_hub_desc.hubd = xhci_hubd; in xhci_roothub_exec()
3518 sc->sc_hub_desc.hubd.bNbrPorts = sc->sc_noport; in xhci_roothub_exec()
3530 USETW(sc->sc_hub_desc.hubd.wHubCharacteristics, i); in xhci_roothub_exec()
3533 sc->sc_hub_desc.hubd.bPwrOn2PwrGood = 10; in xhci_roothub_exec()
3535 for (j = 1; j <= sc->sc_noport; j++) { in xhci_roothub_exec()
3538 sc->sc_hub_desc.hubd. in xhci_roothub_exec()
3542 len = sc->sc_hub_desc.hubd.bLength; in xhci_roothub_exec()
3547 memset(sc->sc_hub_desc.temp, 0, 16); in xhci_roothub_exec()
3554 (index > sc->sc_noport)) { in xhci_roothub_exec()
3592 USETW(sc->sc_hub_desc.ps.wPortStatus, i); in xhci_roothub_exec()
3610 USETW(sc->sc_hub_desc.ps.wPortChange, i); in xhci_roothub_exec()
3611 len = sizeof(sc->sc_hub_desc.ps); in xhci_roothub_exec()
3627 (index > sc->sc_noport)) { in xhci_roothub_exec()
3665 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 250); in xhci_roothub_exec()
3674 /* non-supported speed */ in xhci_roothub_exec()
3731 xfer = parm->curr_xfer; in xhci_xfer_setup()
3736 * +------------------------------------+ in xhci_xfer_setup()
3738 * | |remainder -> | in xhci_xfer_setup()
3739 * | +-----+---+ | in xhci_xfer_setup()
3741 * | +-----+---++ | in xhci_xfer_setup()
3743 * | +-----+----+ | in xhci_xfer_setup()
3745 * +------------------------------------+ in xhci_xfer_setup()
3761 parm->hc_max_packet_size = 0x400; in xhci_xfer_setup()
3762 parm->hc_max_packet_count = 16 * 3; in xhci_xfer_setup()
3763 parm->hc_max_frame_size = XHCI_TD_PAYLOAD_MAX; in xhci_xfer_setup()
3765 xfer->flags_int.bdma_enable = 1; in xhci_xfer_setup()
3769 if (xfer->flags_int.isochronous_xfr) { in xhci_xfer_setup()
3770 ntd = ((1 * xfer->nframes) in xhci_xfer_setup()
3771 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3772 } else if (xfer->flags_int.control_xfr) { in xhci_xfer_setup()
3773 ntd = ((2 * xfer->nframes) + 1 /* STATUS */ in xhci_xfer_setup()
3774 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3776 ntd = ((2 * xfer->nframes) in xhci_xfer_setup()
3777 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3782 if (parm->err) in xhci_xfer_setup()
3793 parm->err = USB_ERR_NOMEM; in xhci_xfer_setup()
3796 if (parm->buf) { in xhci_xfer_setup()
3805 td->td_self = page_info.physaddr; in xhci_xfer_setup()
3806 td->obj_next = last_obj; in xhci_xfer_setup()
3807 td->page_cache = pc + n; in xhci_xfer_setup()
3814 xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; in xhci_xfer_setup()
3816 if (!xfer->flags_int.curr_dma_set) { in xhci_xfer_setup()
3817 xfer->flags_int.curr_dma_set = 1; in xhci_xfer_setup()
3825 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_get_endpoint_state()
3833 hdev = &sc->sc_hw.devs[udev->controller_slot_id]; in xhci_get_endpoint_state()
3835 usbd_get_page(&hdev->device_pc, 0, &buf_dev); in xhci_get_endpoint_state()
3836 endp = XHCI_GET_CTX(sc, xhci_dev_ctx, ctx_ep[epno - 1], in xhci_get_endpoint_state()
3838 usb_pc_cpu_invalidate(&hdev->device_pc); in xhci_get_endpoint_state()
3840 temp = le32toh(endp->dwEpCtx0); in xhci_get_endpoint_state()
3848 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_configure_reset_endpoint()
3861 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_reset_endpoint()
3862 xfer->endpoint->edesc); in xhci_configure_reset_endpoint()
3864 udev = xfer->xroot->udev; in xhci_configure_reset_endpoint()
3865 index = udev->controller_slot_id; in xhci_configure_reset_endpoint()
3867 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_configure_reset_endpoint()
3871 edesc = xfer->endpoint->edesc; in xhci_configure_reset_endpoint()
3873 epno = edesc->bEndpointAddress; in xhci_configure_reset_endpoint()
3874 stream_id = xfer->stream_id; in xhci_configure_reset_endpoint()
3876 if ((edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) in xhci_configure_reset_endpoint()
3921 (pepext->physaddr + (stream_id * sizeof(struct xhci_trb) * in xhci_configure_reset_endpoint()
3936 * So-called control and isochronous transfer types have in xhci_configure_reset_endpoint()
3941 (edesc->bmAttributes & UE_XFERTYPE) != UE_CONTROL && in xhci_configure_reset_endpoint()
3942 (edesc->bmAttributes & UE_XFERTYPE) != UE_ISOCHRONOUS) { in xhci_configure_reset_endpoint()
3950 sc->sc_hw.devs[index].ep_configured &= ~mask; in xhci_configure_reset_endpoint()
3960 if (!(sc->sc_hw.devs[index].ep_configured & mask)) { in xhci_configure_reset_endpoint()
3963 sc->sc_hw.devs[index].ep_configured |= mask; in xhci_configure_reset_endpoint()
3986 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_start_dma_delay()
3989 usbd_transfer_enqueue(&sc->sc_bus.intr_q, xfer); in xhci_start_dma_delay()
3991 (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), in xhci_start_dma_delay()
3992 &sc->sc_config_msg[0], &sc->sc_config_msg[1]); in xhci_start_dma_delay()
4002 sc = XHCI_BUS2SC(((struct usb_bus_msg *)pm)->bus); in xhci_configure_msg()
4005 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
4006 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_msg()
4007 xfer->endpoint->edesc); in xhci_configure_msg()
4009 if ((pepext->trb_halted != 0) || in xhci_configure_msg()
4010 (pepext->trb_running == 0)) { in xhci_configure_msg()
4014 pepext->trb_halted = 0; in xhci_configure_msg()
4015 pepext->trb_running = 0; in xhci_configure_msg()
4027 if (pepext->xfer[i] != NULL) { in xhci_configure_msg()
4028 xhci_device_done(pepext->xfer[i], in xhci_configure_msg()
4038 USB_BUS_UNLOCK(&sc->sc_bus); in xhci_configure_msg()
4042 USB_BUS_LOCK(&sc->sc_bus); in xhci_configure_msg()
4045 if (pepext->trb_halted == 0) { in xhci_configure_msg()
4046 pepext->trb_running = 1; in xhci_configure_msg()
4047 memset(pepext->trb_index, 0, in xhci_configure_msg()
4048 sizeof(pepext->trb_index)); in xhci_configure_msg()
4053 if (xfer->flags_int.did_dma_delay) { in xhci_configure_msg()
4060 /* queue changed - restart */ in xhci_configure_msg()
4065 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
4070 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_configure_msg()
4071 xfer->stream_id, NULL); in xhci_configure_msg()
4085 ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); in xhci_ep_init()
4087 if (udev->parent_hub == NULL) { in xhci_ep_init()
4088 /* root HUB has special endpoint handling */ in xhci_ep_init()
4092 ep->methods = &xhci_device_generic_methods; in xhci_ep_init()
4096 USB_BUS_LOCK(udev->bus); in xhci_ep_init()
4097 pepext->trb_halted = 1; in xhci_ep_init()
4098 pepext->trb_running = 0; in xhci_ep_init()
4102 * endpoints, we need to re-configure the XHCI endpoint in xhci_ep_init()
4105 if ((edesc->bEndpointAddress & UE_ADDR) != 0) { in xhci_ep_init()
4106 sc = XHCI_BUS2SC(udev->bus); in xhci_ep_init()
4107 index = udev->controller_slot_id; in xhci_ep_init()
4108 epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); in xhci_ep_init()
4109 sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); in xhci_ep_init()
4111 USB_BUS_UNLOCK(udev->bus); in xhci_ep_init()
4117 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_ep_uninit()
4118 const struct usb_endpoint_descriptor *edesc = ep->edesc; in xhci_ep_uninit()
4126 if (udev->parent_hub == NULL) { in xhci_ep_uninit()
4127 /* root HUB has special endpoint handling */ in xhci_ep_uninit()
4131 if ((edesc->bEndpointAddress & UE_ADDR) == 0) { in xhci_ep_uninit()
4137 index = udev->controller_slot_id; in xhci_ep_uninit()
4138 epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); in xhci_ep_uninit()
4141 if (sc->sc_hw.devs[index].ep_configured & mask) { in xhci_ep_uninit()
4142 USB_BUS_LOCK(udev->bus); in xhci_ep_uninit()
4144 USB_BUS_UNLOCK(udev->bus); in xhci_ep_uninit()
4146 pcinp = &sc->sc_hw.devs[index].input_pc; in xhci_ep_uninit()
4152 USB_BUS_LOCK(udev->bus); in xhci_ep_uninit()
4153 sc->sc_hw.devs[index].ep_configured &= ~mask; in xhci_ep_uninit()
4154 USB_BUS_UNLOCK(udev->bus); in xhci_ep_uninit()
4167 if (udev->flags.usb_mode != USB_MODE_HOST) { in xhci_ep_clear_stall()
4171 if (udev->parent_hub == NULL) { in xhci_ep_clear_stall()
4172 /* root HUB has special endpoint handling */ in xhci_ep_clear_stall()
4176 pepext = xhci_get_endpoint_ext(udev, ep->edesc); in xhci_ep_clear_stall()
4178 USB_BUS_LOCK(udev->bus); in xhci_ep_clear_stall()
4179 pepext->trb_halted = 1; in xhci_ep_clear_stall()
4180 pepext->trb_running = 0; in xhci_ep_clear_stall()
4181 USB_BUS_UNLOCK(udev->bus); in xhci_ep_clear_stall()
4187 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_init()
4192 if (udev->parent_hub == NULL) in xhci_device_init()
4199 udev->controller_slot_id = sc->sc_noslot + 1; in xhci_device_init()
4210 if (temp > sc->sc_noslot) { in xhci_device_init()
4215 if (sc->sc_hw.devs[temp].state != XHCI_ST_DISABLED) { in xhci_device_init()
4223 udev->controller_slot_id = temp; in xhci_device_init()
4227 memset(&sc->sc_hw.devs[temp], 0, sizeof(sc->sc_hw.devs[0])); in xhci_device_init()
4231 sc->sc_hw.devs[temp].state = XHCI_ST_ENABLED; in xhci_device_init()
4248 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_uninit()
4252 if (udev->parent_hub == NULL) in xhci_device_uninit()
4257 index = udev->controller_slot_id; in xhci_device_uninit()
4259 if (index <= sc->sc_noslot) { in xhci_device_uninit()
4261 sc->sc_hw.devs[index].state = XHCI_ST_DISABLED; in xhci_device_uninit()
4274 * Wait until the hardware has finished any possible use of in xhci_get_dma_delay()
4283 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_resume()
4291 if (udev->parent_hub == NULL) in xhci_device_resume()
4294 index = udev->controller_slot_id; in xhci_device_resume()
4300 USB_BUS_LOCK(udev->bus); in xhci_device_resume()
4309 USB_BUS_UNLOCK(udev->bus); in xhci_device_resume()
4317 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_suspend()
4325 if (udev->parent_hub == NULL) in xhci_device_suspend()
4328 index = udev->controller_slot_id; in xhci_device_suspend()
4354 struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); in xhci_device_state_change()
4360 if (udev->parent_hub == NULL) in xhci_device_state_change()
4363 index = udev->controller_slot_id; in xhci_device_state_change()
4368 err = uhub_query_info(udev, &sc->sc_hw.devs[index].nports, in xhci_device_state_change()
4369 &sc->sc_hw.devs[index].tt); in xhci_device_state_change()
4371 sc->sc_hw.devs[index].nports = 0; in xhci_device_state_change()
4378 if (sc->sc_hw.devs[index].state == XHCI_ST_DEFAULT) in xhci_device_state_change()
4382 sc->sc_hw.devs[index].state = XHCI_ST_DEFAULT; in xhci_device_state_change()
4383 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4386 sc->sc_hw.devs[index].context_num = 0; in xhci_device_state_change()
4397 if (sc->sc_hw.devs[index].state == XHCI_ST_ADDRESSED) in xhci_device_state_change()
4400 sc->sc_hw.devs[index].state = XHCI_ST_ADDRESSED; in xhci_device_state_change()
4401 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4416 if (sc->sc_hw.devs[index].state == XHCI_ST_CONFIGURED) { in xhci_device_state_change()
4427 sc->sc_hw.devs[index].state = XHCI_ST_CONFIGURED; in xhci_device_state_change()
4428 sc->sc_hw.devs[index].ep_configured = 3U; in xhci_device_state_change()
4431 sc->sc_hw.devs[index].context_num = 0; in xhci_device_state_change()
4433 usbd_get_page(&sc->sc_hw.devs[index].input_pc, 0, &buf_inp); in xhci_device_state_change()
4465 (ep->edesc->bmAttributes & UE_XFERTYPE) != UE_BULK || in xhci_set_endpoint_mode()
4466 udev->speed != USB_SPEED_SUPER) in xhci_set_endpoint_mode()