Home | History | Annotate | Download | only in ic

Lines Matching defs:spipe

666 #define slhci_log_spipe(spipe) ((void)0)
682 #define LK_SLASSERT(exp, sc, spipe, xfer, ext) do { \
686 slhci_halt(sc, spipe, xfer); \
690 #define UL_SLASSERT(exp, sc, spipe, xfer, ext) do { \
694 slhci_lock_call(sc, &slhci_halt, spipe, xfer); \
699 #define LK_SLASSERT(exp, sc, spipe, xfer, ext) ((void)0)
700 #define UL_SLASSERT(exp, sc, spipe, xfer, ext) ((void)0)
758 enter_waitq(struct slhci_softc *sc, struct slhci_pipe *spipe)
760 gcq_insert_tail(&sc->sc_waitq, &spipe->xq);
764 enter_q(struct slhci_transfers *t, struct slhci_pipe *spipe, int i)
766 gcq_insert_tail(&t->q[i], &spipe->xq);
770 enter_callback(struct slhci_transfers *t, struct slhci_pipe *spipe)
772 gcq_insert_tail(&t->q[Q_CALLBACKS], &spipe->xq);
776 enter_all_pipes(struct slhci_transfers *t, struct slhci_pipe *spipe)
778 gcq_insert_tail(&t->ap, &spipe->ap);
807 DLOG(D_MEM, "freex xfer %#jx spipe %#jx",
844 DLOG(D_TRACE, "transfer type %jd xfer %#jx spipe %#jx ",
861 struct slhci_pipe *spipe = SLHCI_PIPE2SPIPE(pipe);
870 DLOG(D_TRACE, "transfer type %jd start xfer %#jx spipe %#jx length %jd",
871 spipe->ptype, (uintptr_t)xfer, (uintptr_t)spipe, xfer->ux_length);
875 KASSERT(spipe->xfer == NULL); /* not SLASSERT */
880 spipe->xfer = xfer;
882 spipe->nerrs = 0;
883 spipe->frame = t->frame;
884 spipe->control = SL11_EPCTRL_ARM_ENABLE;
885 spipe->tregs[DEV] = pipe->up_dev->ud_addr;
886 spipe->tregs[PID] = spipe->newpid = UE_GET_ADDR(ed->bEndpointAddress)
889 spipe->newlen[0] = xfer->ux_length % max_packet;
890 spipe->newlen[1] = uimin(xfer->ux_length, max_packet);
892 if (spipe->ptype == PT_BULK || spipe->ptype == PT_INTR) {
893 if (spipe->pflags & PF_TOGGLE)
894 spipe->control |= SL11_EPCTRL_DATATOGGLE;
895 spipe->tregs[LEN] = spipe->newlen[1];
896 if (spipe->tregs[LEN])
897 spipe->buffer = xfer->ux_buf;
899 spipe->buffer = NULL;
900 spipe->lastframe = t->frame;
901 if (spipe->ptype == PT_INTR) {
902 spipe->frame = spipe->lastframe +
903 spipe->pipe.up_interval;
907 if (__predict_false(spipe->ptype == PT_INTR &&
908 xfer->ux_length > spipe->tregs[LEN])) {
920 spipe->tregs[PID] |= SL11_PID_SETUP;
921 spipe->tregs[LEN] = 8;
922 spipe->buffer = (uint8_t *)&xfer->ux_request;
923 DLOGBUF(D_XFER, spipe->buffer, spipe->tregs[LEN]);
924 spipe->ptype = PT_CTRL_SETUP;
925 spipe->newpid &= ~SL11_PID_BITS;
928 spipe->newpid |= SL11_PID_IN;
930 spipe->newpid |= SL11_PID_OUT;
934 spipe->tregs[LEN] == max_packet &&
935 (spipe->newpid & SL11_PID_BITS) == SL11_PID_OUT)
936 spipe->wantshort = 1;
938 spipe->wantshort = 0;
948 if (spipe->pflags & PF_LS) {
953 if (spipe->pflags & PF_PREAMBLE)
954 spipe->control |= SL11_EPCTRL_PREAMBLE;
956 spipe->bustime = SLHCI_LS_CONST +
957 SLHCI_LS_DATA_TIME(spipe->tregs[LEN]);
958 spipe->newbustime[0] = SLHCI_LS_CONST +
959 SLHCI_LS_DATA_TIME(spipe->newlen[0]);
960 spipe->newbustime[1] = SLHCI_LS_CONST +
961 SLHCI_LS_DATA_TIME(spipe->newlen[1]);
966 spipe, xfer, return USBD_IN_PROGRESS);
968 spipe->bustime = SLHCI_FS_CONST +
969 SLHCI_FS_DATA_TIME(spipe->tregs[LEN]);
970 spipe->newbustime[0] = SLHCI_FS_CONST +
971 SLHCI_FS_DATA_TIME(spipe->newlen[0]);
972 spipe->newbustime[1] = SLHCI_FS_CONST +
973 SLHCI_FS_DATA_TIME(spipe->newlen[1]);
983 if ((spipe->tregs[PID] & SL11_PID_BITS) != SL11_PID_IN)
984 spipe->control |= SL11_EPCTRL_DIRECTION;
986 slhci_start_entry(sc, spipe);
996 struct slhci_pipe *spipe __diagused;
998 spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe);
1003 LK_SLASSERT(spipe != NULL && xfer != NULL, sc, spipe, xfer, return
1011 KASSERT(spipe->ptype == PT_ROOT_INTR);
1026 struct slhci_pipe *spipe;
1033 spipe = SLHCI_PIPE2SPIPE(pipe);
1040 spipe->pflags = 0;
1041 spipe->frame = 0;
1042 spipe->lastframe = 0;
1043 spipe->xfer = NULL;
1044 spipe->buffer = NULL;
1046 gcq_init(&spipe->ap);
1047 gcq_init(&spipe->to);
1048 gcq_init(&spipe->xq);
1059 spipe->pflags |= PF_LS;
1061 spipe->pflags |= PF_PREAMBLE;
1064 spipe, NULL);
1071 DLOG(D_ERR, "packet too large! size %jd spipe %#jx", max_packet,
1072 (uintptr_t)spipe, 0,0);
1079 spipe->ptype = PT_ROOT_CTRL;
1084 spipe->ptype = PT_ROOT_INTR;
1097 spipe->ptype = PT_CTRL_SETUP;
1101 spipe->ptype = PT_INTR;
1106 return slhci_lock_call(sc, &slhci_isoc_warn, spipe,
1109 spipe->ptype = PT_BULK;
1114 DLOG(D_MSG, "open pipe type %jd interval %jd", spipe->ptype,
1119 return slhci_lock_call(sc, &slhci_open_pipe, spipe, NULL);
1324 struct slhci_pipe *spipe;
1326 spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe);
1328 if (spipe == NULL)
1334 DLOG(D_TRACE, "transfer type %jd abort xfer %#jx spipe %#jx "
1335 " spipe->xfer %#jx", spipe->ptype, (uintptr_t)xfer,
1336 (uintptr_t)spipe, (uintptr_t)spipe->xfer);
1338 slhci_lock_call(sc, &slhci_do_abort, spipe, xfer);
1350 struct slhci_pipe *spipe;
1353 spipe = SLHCI_PIPE2SPIPE(pipe);
1355 DLOG(D_TRACE, "transfer type %jd close spipe %#jx spipe->xfer %#jx",
1356 spipe->ptype, (uintptr_t)spipe, (uintptr_t)spipe->xfer, 0);
1358 slhci_lock_call(sc, &slhci_close_pipe, spipe, NULL);
1365 struct slhci_pipe *spipe;
1367 spipe = SLHCI_PIPE2SPIPE(pipe);
1369 DLOG(D_TRACE, "transfer type %jd toggle spipe %#jx", spipe->ptype,
1370 (uintptr_t)spipe, 0, 0);
1372 spipe->pflags &= ~PF_TOGGLE;
1375 if (spipe->xfer != NULL) {
1444 *spipe, struct usbd_xfer *xfer)
1449 ret = (*lcf)(sc, spipe, xfer);
1457 slhci_start_entry(struct slhci_softc *sc, struct slhci_pipe *spipe)
1465 slhci_enter_xfer(sc, spipe);
1469 enter_waitq(sc, spipe);
1933 struct slhci_pipe *spipe;
1946 DLOG(D_MSG, "DONE AB=%jd spipe %#jx len %jd xfer %#jx", ab,
1947 t->spipe[ab], (uintptr_t)t->len[ab],
1948 (uintptr_t)(t->spipe[ab] ? t->spipe[ab]->xfer : NULL));
1950 spipe = t->spipe[ab];
1956 if (spipe == NULL)
1959 t->spipe[ab] = NULL;
1961 xfer = spipe->xfer;
1963 gcq_remove(&spipe->to);
1965 LK_SLASSERT(xfer != NULL, sc, spipe, NULL, return);
2017 DDOLOG("no status! xfer %p spipe %p", xfer, spipe, 0,0);
2019 slhci_halt(sc, spipe, xfer);
2033 unsigned int len = spipe->tregs[LEN];
2046 spipe->nerrs = 0;
2050 if (actlen && (spipe->tregs[PID] & SL11_PID_BITS) == SL11_PID_IN) {
2051 target_buf = spipe->buffer;
2052 buf_start = spipe->tregs[ADR];
2065 slhci_halt(sc, spipe, xfer);
2078 int i = spipe->pipe.up_interval;
2081 DDOLOG("xfer %p spipe %p NAK delay by %d", xfer, spipe,
2083 spipe->lastframe = spipe->frame = t->frame + i;
2084 slhci_queue_timed(sc, spipe);
2086 } else if (++spipe->nerrs > SLHCI_MAX_RETRIES ||
2088 DDOLOG("xfer %p spipe %p nerrs %d", xfer, spipe,
2089 spipe->nerrs, 0);
2106 } else if (spipe->ptype == PT_CTRL_SETUP) {
2107 spipe->tregs[PID] = spipe->newpid;
2110 LK_SLASSERT(spipe->newlen[1] != 0, sc, spipe, xfer,
2112 spipe->tregs[LEN] = spipe->newlen[1];
2113 spipe->bustime = spipe->newbustime[1];
2114 spipe->buffer = xfer->ux_buf;
2115 spipe->ptype = PT_CTRL_DATA;
2119 spipe->tregs[LEN] = 0;
2120 if (spipe->pflags & PF_LS)
2121 spipe->bustime = SLHCI_LS_CONST;
2123 spipe->bustime = SLHCI_FS_CONST;
2124 spipe->ptype = PT_CTRL_STATUS;
2125 spipe->buffer = NULL;
2129 spipe->control |= SL11_EPCTRL_DATATOGGLE;
2130 if ((spipe->tregs[PID] & SL11_PID_BITS) == SL11_PID_IN)
2131 spipe->control &= ~SL11_EPCTRL_DIRECTION;
2133 spipe->control |= SL11_EPCTRL_DIRECTION;
2136 } else if (spipe->ptype == PT_CTRL_STATUS) {
2140 spipe->control ^= SL11_EPCTRL_DATATOGGLE;
2142 if (actlen == spipe->tregs[LEN] &&
2143 (xfer->ux_length > xfer->ux_actlen || spipe->wantshort)) {
2144 spipe->buffer += actlen;
2146 spipe, xfer, return);
2148 spipe->wantshort = 0;
2149 spipe->tregs[LEN] = spipe->newlen[0];
2150 spipe->bustime = spipe->newbustime[0];
2152 spipe->tregs[LEN] == xfer->ux_length, sc,
2153 spipe, xfer, return);
2156 } else if (spipe->ptype == PT_CTRL_DATA) {
2157 spipe->tregs[PID] ^= SLHCI_PID_SWAP_IN_OUT;
2160 if (spipe->ptype == PT_INTR) {
2161 spipe->lastframe +=
2162 spipe->pipe.up_interval;
2168 spipe->frame = spipe->lastframe +
2169 spipe->pipe.up_interval;
2178 if (spipe->control & SL11_EPCTRL_DATATOGGLE)
2179 spipe->pflags |= PF_TOGGLE;
2181 spipe->pflags &= ~PF_TOGGLE;
2188 gcq_remove(&spipe->to);
2192 spipe, xfer, return);
2197 enter_q(t, spipe, head);
2217 struct slhci_pipe *spipe;
2246 spipe = t->spipe[A];
2247 if (spipe == NULL) {
2250 } else if (remaining_bustime >= spipe->bustime) {
2253 start_cc_time(&t_ab[A], spipe->tregs[LEN]);
2254 slhci_write(sc, SL11_E0CTRL, spipe->control);
2259 spipe = t->spipe[B];
2260 if (spipe == NULL) {
2263 } else if (remaining_bustime >= spipe->bustime) {
2266 start_cc_time(&t_ab[B], spipe->tregs[LEN]);
2267 slhci_write(sc, SL11_E1CTRL, spipe->control);
2269 t->pend = spipe->bustime;
2279 struct slhci_pipe *spipe;
2287 spipe, t, spipe->frame <= t->frame) ||
2288 GOT_FIRST_CB(spipe, t))) {
2289 LK_SLASSERT(spipe->xfer != NULL, sc, spipe, NULL, return);
2290 LK_SLASSERT(spipe->ptype != PT_ROOT_CTRL && spipe->ptype !=
2291 PT_ROOT_INTR, sc, spipe, NULL, return);
2294 if (t->len[A] + t->len[B] + spipe->tregs[LEN] + 1 >
2297 "len %jd", t->len[A], t->len[B], spipe->tregs[LEN],
2302 gcq_remove(&spipe->xq);
2306 spipe->tregs[ADR] = SL11_BUFFER_START;
2309 spipe->tregs[ADR] = SL11_BUFFER_END -
2310 spipe->tregs[LEN];
2313 t->len[ab] = spipe->tregs[LEN];
2315 if (spipe->tregs[LEN] && (spipe->tregs[PID] & SL11_PID_BITS)
2318 spipe->tregs[LEN]);
2319 slhci_write_multi(sc, spipe->tregs[ADR],
2320 spipe->buffer, spipe->tregs[LEN]);
2323 SLHCI_FS_DATA_TIME(spipe->tregs[LEN]);
2329 if (spipe->tregs[LEN])
2335 if (t->current_tregs[ab][i] != spipe->tregs[i]) {
2336 t->current_tregs[ab][i] = spipe->tregs[i];
2338 spipe->tregs[i]);
2342 spipe->tregs[LEN], spipe->tregs[PID], spipe->tregs[DEV],
2343 spipe->ptype);
2345 t->spipe[ab] = spipe;
2360 struct slhci_pipe *spipe;
2386 if (!DEQUEUED_CALLBACK(spipe, t))
2389 xfer = spipe->xfer;
2390 LK_SLASSERT(xfer != NULL, sc, spipe, NULL, return);
2391 spipe->xfer = NULL;
2392 DLOG(D_XFER, "xfer callback length %jd actlen %jd spipe %#jx "
2394 (uintptr_t)spipe, spipe->ptype);
2401 slhci_enter_xfer(struct slhci_softc *sc, struct slhci_pipe *spipe)
2411 __predict_false(spipe->pflags & PF_GONE)) {
2413 spipe->xfer->ux_status = USBD_CANCELLED;
2416 if (spipe->xfer->ux_status == USBD_IN_PROGRESS) {
2417 if (spipe->xfer->ux_timeout) {
2418 spipe->to_frame = t->frame + spipe->xfer->ux_timeout;
2419 slhci_xfer_timer(sc, spipe);
2421 if (spipe->pipe.up_interval)
2422 slhci_queue_timed(sc, spipe);
2424 enter_q(t, spipe, Q_CB);
2426 enter_callback(t, spipe);
2432 struct slhci_pipe *spipe;
2436 while (DEQUEUED_WAITQ(spipe, sc))
2437 slhci_enter_xfer(sc, spipe);
2441 slhci_queue_timed(struct slhci_softc *sc, struct slhci_pipe *spipe)
2451 FIND_TIMED(q, t, spp, spp->frame > spipe->frame);
2452 gcq_insert_before(q, &spipe->xq);
2456 slhci_xfer_timer(struct slhci_softc *sc, struct slhci_pipe *spipe)
2466 FIND_TO(q, t, spp, spp->to_frame >= spipe->to_frame);
2467 gcq_insert_before(q, &spipe->to);
2516 slhci_do_poll(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2525 slhci_lsvh_warn(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2544 slhci_isoc_warn(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2563 slhci_open_pipe(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2570 pipe = &spipe->pipe;
2574 else if (pipe->up_interval && !slhci_reserve_bustime(sc, spipe, 1))
2577 enter_all_pipes(t, spipe);
2583 slhci_close_pipe(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2588 pipe = &spipe->pipe;
2590 if (pipe->up_interval && spipe->ptype != PT_ROOT_INTR)
2591 slhci_reserve_bustime(sc, spipe, 0);
2592 gcq_remove(&spipe->ap);
2597 slhci_do_abort(struct slhci_softc *sc, struct slhci_pipe *spipe, struct
2606 if (spipe->xfer == xfer) {
2607 if (spipe->ptype == PT_ROOT_INTR) {
2608 if (t->rootintr == spipe->xfer) /* XXX assert? */
2611 gcq_remove(&spipe->to);
2612 gcq_remove(&spipe->xq);
2614 if (t->spipe[A] == spipe) {
2615 t->spipe[A] = NULL;
2618 } else if (t->spipe[B] == spipe) {
2619 t->spipe[B] = NULL;
2626 spipe->xfer = NULL;
2627 spipe->pipe.up_repeat = 0; /* XXX timeout? */
2639 slhci_halt(struct slhci_softc *sc, struct slhci_pipe *spipe,
2649 DDOLOG("Halt! sc %p spipe %p xfer %p", sc, spipe, xfer, 0);
2651 if (spipe != NULL)
2652 slhci_log_spipe(spipe);
2657 if (spipe != NULL && xfer != NULL && spipe->xfer == xfer &&
2658 !gcq_onlist(&spipe->xq) && t->spipe[A] != spipe && t->spipe[B] !=
2659 spipe) {
2661 enter_callback(t, spipe);
2713 struct slhci_pipe *spipe;
2727 if (t->spipe[i] != NULL) {
2728 enter_callback(t, t->spipe[i]);
2729 t->spipe[i] = NULL;
2742 FOREACH_AP(q, t, spipe) {
2743 spipe->pflags |= PF_GONE;
2744 spipe->pipe.up_repeat = 0;
2745 spipe->pipe.up_aborting = 1;
2746 if (spipe->xfer != NULL)
2747 spipe->xfer->ux_status = USBD_CANCELLED;
2772 struct slhci_pipe *spipe;
2866 FOREACH_AP(q, t, spipe) {
2867 spipe->pflags &= ~PF_GONE;
2868 spipe->pipe.up_aborting = 0;
2957 slhci_reserve_bustime(struct slhci_softc *sc, struct slhci_pipe *spipe, int
2967 max_packet = UGETW(spipe->pipe.up_endpoint->ue_edesc->wMaxPacketSize);
2969 if (spipe->pflags & PF_LS)
3466 slhci_log_spipe(struct slhci_pipe *spipe)
3469 DDOLOG("spipe %p onlists: AP=%d TO=%d XQ=%d", spipe,
3470 gcq_onlist(&spipe->ap) ? 1 : 0,
3471 gcq_onlist(&spipe->to) ? 1 : 0,
3472 gcq_onlist(&spipe->xq) ? 1 : 0);
3473 DDOLOG("spipe: xfer %p buffer %p pflags %#x ptype %d",
3474 spipe->xfer, spipe->buffer, spipe->pflags, spipe->ptype);
3498 DDOLOG("a = %p Alen=%d b = %p Blen=%d", t->spipe[0], t->len[0],
3499 t->spipe[1], t->len[1]);