/* *periodic_next_shadow-return"next"pointeronshadowlist *@periodic:hostpointertoqh/itd/sitd *@tag:hardwaretagfortypeofthisrecord
*/ staticunion ehci_shadow *
periodic_next_shadow(struct ehci_hcd *ehci, union ehci_shadow *periodic,
__hc32 tag)
{ switch (hc32_to_cpu(ehci, tag)) { case Q_TYPE_QH: return &periodic->qh->qh_next; case Q_TYPE_FSTN: return &periodic->fstn->fstn_next; case Q_TYPE_ITD: return &periodic->itd->itd_next; /* case Q_TYPE_SITD: */ default: return &periodic->sitd->sitd_next;
}
}
static __hc32 *
shadow_next_periodic(struct ehci_hcd *ehci, union ehci_shadow *periodic,
__hc32 tag)
{ switch (hc32_to_cpu(ehci, tag)) { /* our ehci_shadow.qh is actually software part */ case Q_TYPE_QH: return &periodic->qh->hw->hw_next; /* others are hw parts */ default: return periodic->hw_next;
}
}
/* caller must hold ehci->lock */ staticvoid periodic_unlink(struct ehci_hcd *ehci, unsigned frame, void *ptr)
{ union ehci_shadow *prev_p = &ehci->pshadow[frame];
__hc32 *hw_p = &ehci->periodic[frame]; union ehci_shadow here = *prev_p;
/* find predecessor of "ptr"; hw and shadow lists are in sync */ while (here.ptr && here.ptr != ptr) {
prev_p = periodic_next_shadow(ehci, prev_p,
Q_NEXT_TYPE(ehci, *hw_p));
hw_p = shadow_next_periodic(ehci, &here,
Q_NEXT_TYPE(ehci, *hw_p));
here = *prev_p;
} /* an interrupt entry (at list end) could have been shared */ if (!here.ptr) return;
/* update shadow and hardware lists ... the old "next" pointers *fromptrmaystillbeinuse,thecallerupdatesthem.
*/
*prev_p = *periodic_next_shadow(ehci, &here,
Q_NEXT_TYPE(ehci, *hw_p));
/* Release the TT above udev, if it's not in use */ staticvoid drop_tt(struct usb_device *udev)
{ struct usb_tt *utt = udev->tt; struct ehci_tt *tt, **tt_index, **ptt; int cnt, i;
if (!utt || !utt->hcpriv) return; /* Not below a TT, or never allocated */
cnt = 0; if (utt->multi) {
tt_index = utt->hcpriv;
ptt = &tt_index[udev->ttport - 1];
/* How many entries are left in tt_index? */ for (i = 0; i < utt->hub->maxchild; ++i)
cnt += !!tt_index[i];
} else {
tt_index = NULL;
ptt = (struct ehci_tt **) &utt->hcpriv;
}
tt = *ptt; if (!tt || !list_empty(&tt->ps_list)) return; /* never allocated, or still in use */
/* Entire transaction (high speed) or start-split (full/low speed) */ for (i = start_uf + qh->ps.phase_uf; i < EHCI_BANDWIDTH_SIZE;
i += qh->ps.bw_uperiod)
ehci->bandwidth[i] += usecs;
/* Complete-split (full/low speed) */ if (qh->ps.c_usecs) { /* NOTE: adjustments needed for FSTN */ for (i = start_uf; i < EHCI_BANDWIDTH_SIZE;
i += qh->ps.bw_uperiod) { for ((j = 2, m = 1 << (j+8)); j < 8; (++j, m <<= 1)) { if (qh->ps.cs_mask & m)
ehci->bandwidth[i+j] += c_usecs;
}
}
}
/* FS/LS bus bandwidth */ if (tt_usecs) { /* *find_tt()willnotreturnanyerrorhereaswehave *alreadycalledfind_tt()beforecallingthisfunction *andcheckedforanyerrorreturn.Thepreviouscall *wouldhavecreatedthedatastructure.
*/
tt = find_tt(qh->ps.udev); if (sign > 0)
list_add_tail(&qh->ps.ps_list, &tt->ps_list); else
list_del(&qh->ps.ps_list);
for (i = start_uf >> 3; i < EHCI_BANDWIDTH_FRAMES;
i += qh->ps.bw_period)
tt->bandwidth[i] += tt_usecs;
}
}
if (!tt) return;
memset(budget_table, 0, EHCI_BANDWIDTH_SIZE);
/* Add up the contributions from all the endpoints using this TT */
list_for_each_entry(ps, &tt->ps_list, ps_list) { for (uframe = ps->bw_phase << 3; uframe < EHCI_BANDWIDTH_SIZE;
uframe += ps->bw_uperiod) {
budget_line = &budget_table[uframe];
x = ps->tt_usecs;
/* propagate the time forward */ for (uf = ps->phase_uf; uf < 8; ++uf) {
x += budget_line[uf];
/* Each microframe lasts 125 us */ if (x <= 125) {
budget_line[uf] = x; break;
}
budget_line[uf] = 125;
x -= 125;
}
}
}
}
staticint __maybe_unused same_tt(struct usb_device *dev1, struct usb_device *dev2)
{ if (!dev1->tt || !dev2->tt) return0; if (dev1->tt != dev2->tt) return0; if (dev1->tt->multi) return dev1->ttport == dev2->ttport; else return1;
}
for (frame &= period - 1; frame < EHCI_BANDWIDTH_FRAMES;
frame += period) { unsigned i, uf; unsignedshort tt_usecs[8];
if (tt->bandwidth[frame] + usecs > 900) return0;
uf = frame << 3; for (i = 0; i < 8; (++i, ++uf))
tt_usecs[i] = ehci->tt_budget[uf];
if (max_tt_usecs[uframe] <= tt_usecs[uframe]) return0;
/* special case for isoc transfers larger than 125us: *thefirstandeachsubsequentfullyuseduframe *mustbeempty,soastonotillegallydelay *alreadyscheduledtransactions
*/ if (usecs > 125) { int ufs = (usecs / 125);
for (i = uframe; i < (uframe + ufs) && i < 8; i++) if (tt_usecs[i] > 0) return0;
}
tt_usecs[uframe] += usecs;
carryover_tt_bandwidth(tt_usecs);
/* fail if the carryover pushed bw past the last uframe's limit */ if (max_tt_usecs[7] < tt_usecs[7]) return0;
}
return1;
}
#else
/* return true iff the device's transaction translator is available *foraperiodictransferstartingatthespecifiedframe,using *alltheuframesinthemask.
*/ staticint tt_no_collision( struct ehci_hcd *ehci, unsigned period, struct usb_device *dev, unsigned frame,
u32 uf_mask
)
{ if (period == 0) /* error */ return0;
/* note bandwidth wastage: split never follows csplit *(differentdevorendpoint)untilthenextuframe. *callingconventiondoesn'tmakethatdistinction.
*/ for (; frame < ehci->periodic_size; frame += period) { union ehci_shadow here;
__hc32 type; struct ehci_qh_hw *hw;
here = ehci->pshadow[frame];
type = Q_NEXT_TYPE(ehci, ehci->periodic[frame]); while (here.ptr) { switch (hc32_to_cpu(ehci, type)) { case Q_TYPE_ITD:
type = Q_NEXT_TYPE(ehci, here.itd->hw_next);
here = here.itd->itd_next; continue; case Q_TYPE_QH:
hw = here.qh->hw; if (same_tt(dev, here.qh->ps.udev)) {
u32 mask;
mask = hc32_to_cpu(ehci,
hw->hw_info2); /* "knows" no gap is needed */
mask |= mask >> 8; if (mask & uf_mask) break;
}
type = Q_NEXT_TYPE(ehci, hw->hw_next);
here = here.qh->qh_next; continue; case Q_TYPE_SITD: if (same_tt(dev, here.sitd->urb->dev)) {
u16 mask;
mask = hc32_to_cpu(ehci, here.sitd
->hw_uframe); /* FIXME assumes no gap for IN! */
mask |= mask >> 8; if (mask & uf_mask) break;
}
type = Q_NEXT_TYPE(ehci, here.sitd->hw_next);
here = here.sitd->sitd_next; continue; /* case Q_TYPE_FSTN: */ default:
ehci_dbg(ehci, "periodic frame %d bogus type %d\n",
frame, type);
}
/* high bandwidth, or otherwise every microframe */ if (period == 0)
period = 1;
for (i = qh->ps.phase; i < ehci->periodic_size; i += period) { union ehci_shadow *prev = &ehci->pshadow[i];
__hc32 *hw_p = &ehci->periodic[i]; union ehci_shadow here = *prev;
__hc32 type = 0;
/* skip the iso nodes at list head */ while (here.ptr) {
type = Q_NEXT_TYPE(ehci, *hw_p); if (type == cpu_to_hc32(ehci, Q_TYPE_QH)) break;
prev = periodic_next_shadow(ehci, prev, type);
hw_p = shadow_next_periodic(ehci, &here, type);
here = *prev;
}
/* sorting each branch by period (slow-->fast) *enablessharinginteriortreenodes
*/ while (here.ptr && qh != here.qh) { if (qh->ps.period > here.qh->ps.period) break;
prev = &here.qh->qh_next;
hw_p = &here.qh->hw->hw_next;
here = *prev;
} /* link in this qh, unless some earlier pass did that */ if (qh != here.qh) {
qh->qh_next = here; if (here.qh)
qh->hw->hw_next = *hw_p;
wmb();
prev->qh = qh;
*hw_p = QH_NEXT(ehci, qh->qh_dma);
}
}
qh->qh_state = QH_STATE_LINKED;
qh->xacterrs = 0;
qh->unlink_reason = 0;
staticvoid start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh)
{ /* If the QH isn't linked then there's nothing we can do. */ if (qh->qh_state != QH_STATE_LINKED) return;
/* if the qh is waiting for unlink, cancel it now */
cancel_unlink_wait_intr(ehci, qh);
qh_unlink_periodic(ehci, qh);
/* Make sure the unlinks are visible before starting the timer */
wmb();
/* TODO : this may need FSTN for SSPLIT in uframe 5. */ for (i = uframe+2; i < 8 && i <= uframe+4; i++) if (!check_period(ehci, frame, i,
qh->ps.bw_uperiod, qh->ps.c_usecs)) goto done; else
mask |= 1 << i;
retval = 0;
*c_maskp = mask;
} #else /* Make sure this tt's buffer is also available for CSPLITs. *Wepessimizeabit;probablythetypicalfullspeedcase *doesn'tneedthesecondCSPLIT. * *NOTE:bothSPLITandCSPLITcouldbecheckedinjust *onesmartpass...
*/
mask = 0x03 << (uframe + qh->gap_uf);
*c_maskp = mask;
/* "first fit" scheduling policy used the first time through, *orwhenthepreviousscheduleslotcan'tbere-used.
*/ staticint qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh)
{ int status = 0; unsigned uframe; unsigned c_mask; struct ehci_qh_hw *hw = qh->hw; struct ehci_tt *tt;
hw->hw_next = EHCI_LIST_END(ehci);
/* reuse the previous schedule slots, if we can */ if (qh->ps.phase != NO_FRAME) {
ehci_dbg(ehci, "reused qh %p schedule\n", qh); return0;
}
uframe = 0;
c_mask = 0;
tt = find_tt(qh->ps.udev); if (IS_ERR(tt)) {
status = PTR_ERR(tt); goto done;
}
compute_tt_budget(ehci->tt_budget, tt);
/* else scan the schedule to find a group of slots such that all *uframeshaveenoughperiodicbandwidthavailable.
*/ /* "normal" case, uframing flexible except with splits */ if (qh->ps.bw_period) { int i; unsigned frame;
for (i = qh->ps.bw_period; i > 0; --i) {
frame = ++ehci->random_frame & (qh->ps.bw_period - 1); for (uframe = 0; uframe < 8; uframe++) {
status = check_intr_schedule(ehci,
frame, uframe, qh, &c_mask, tt); if (status == 0) goto got_it;
}
}
/* qh->ps.bw_period == 0 means every uframe */
} else {
status = check_intr_schedule(ehci, 0, 0, qh, &c_mask, tt);
} if (status) goto done;
/* get endpoint and transfer/schedule data */
epnum = urb->ep->desc.bEndpointAddress;
spin_lock_irqsave(&ehci->lock, flags);
if (unlikely(!HCD_HW_ACCESSIBLE(ehci_to_hcd(ehci)))) {
status = -ESHUTDOWN; goto done_not_linked;
}
status = usb_hcd_link_urb_to_ep(ehci_to_hcd(ehci), urb); if (unlikely(status)) goto done_not_linked;
/* get qh and force any scheduling errors */
INIT_LIST_HEAD(&empty);
qh = qh_append_tds(ehci, urb, &empty, epnum, &urb->ep->hcpriv); if (qh == NULL) {
status = -ENOMEM; goto done;
} if (qh->qh_state == QH_STATE_IDLE) {
status = qh_schedule(ehci, qh); if (status) goto done;
}
/* then queue the urb's tds to the qh */
qh = qh_append_tds(ehci, urb, qtd_list, epnum, &urb->ep->hcpriv);
BUG_ON(qh == NULL);
/* stuff into the periodic schedule */ if (qh->qh_state == QH_STATE_IDLE) {
qh_refresh(ehci, qh);
qh_link_periodic(ehci, qh);
} else { /* cancel unlink wait for the qh */
cancel_unlink_wait_intr(ehci, qh);
}
/* how many uframes are needed for these transfers */
iso_sched->span = urb->number_of_packets * stream->uperiod;
/* figure out per-uframe itd fields that we'll need later *whenwefitnewitdsintotheschedule.
*/ for (i = 0; i < urb->number_of_packets; i++) { struct ehci_iso_packet *uframe = &iso_sched->packet[i]; unsigned length;
dma_addr_t buf;
u32 trans;
if (!stream->splits) { /* High speed */ for (i = uframe + stream->ps.phase_uf; i < EHCI_BANDWIDTH_SIZE;
i += stream->ps.bw_uperiod)
ehci->bandwidth[i] += usecs;
/* NOTE: adjustment needed for frame overflow */ for (i = uframe; i < EHCI_BANDWIDTH_SIZE;
i += stream->ps.bw_uperiod) { for ((j = stream->ps.phase_uf, m = 1 << j); j < 8;
(++j, m <<= 1)) { if (s_mask & m)
ehci->bandwidth[i+j] += usecs; elseif (c_mask & m)
ehci->bandwidth[i+j] += c_usecs;
}
}
#ifdef CONFIG_USB_EHCI_TT_NEWSCHED /* The tt's fullspeed bus bandwidth must be available. *tt_availableschedulingguarantees10+%forcontrol/bulk.
*/
uf = uframe & 7; if (!tt_available(ehci, &stream->ps, tt, frame, uf)) return0; #else /* tt must be idle for start(s), any gap, and csplit. *assumeschedulingslopleaves10+%forcontrol/bulk.
*/ if (!tt_no_collision(ehci, stream->ps.bw_period,
stream->ps.udev, frame, mask)) return0; #endif
do { unsigned max_used; unsigned i;
/* check starts (OUT uses more than one) */
uf = uframe;
max_used = ehci->uframe_periodic_max - stream->ps.usecs; for (tmp = stream->ps.cs_mask & 0xff; tmp; tmp >>= 1, uf++) { if (ehci->bandwidth[uf] > max_used) return0;
}
/* for IN, check CSPLIT */ if (stream->ps.c_usecs) {
max_used = ehci->uframe_periodic_max -
stream->ps.c_usecs;
uf = uframe & ~7;
tmp = 1 << (2+8); for (i = (uframe & 7) + 2; i < 8; (++i, tmp <<= 1)) { if ((stream->ps.cs_mask & tmp) == 0) continue; if (ehci->bandwidth[uf+i] > max_used) return0;
}
}
uframe += stream->ps.bw_uperiod;
} while (uframe < EHCI_BANDWIDTH_SIZE);
/* find a uframe slot with enough bandwidth. *Earlyuframesaremorepreciousbecausefull-speed *isoINtransferscan'tuselateuframes, *andthereforetheyshouldbeallocatedlast.
*/
next = start;
start += period; do {
start--; /* check schedule: enough space? */ if (stream->highspeed) { if (itd_slot_ok(ehci, stream, start))
done = 1;
} else { if ((start % 8) >= 6) continue; if (sitd_slot_ok(ehci, stream, start,
sched, tt))
done = 1;
}
} while (start > next && !done);
/* no room in the schedule */ if (!done) {
ehci_dbg(ehci, "iso sched full %p", urb);
status = -ENOSPC; goto fail;
}
stream->ps.phase = (start >> 3) &
(stream->ps.period - 1);
stream->ps.bw_phase = stream->ps.phase &
(stream->ps.bw_period - 1);
stream->ps.phase_uf = start & 7;
reserve_release_iso_bandwidth(ehci, stream, 1);
}
/* New stream is already scheduled; use the upcoming slot */ else {
start = (stream->ps.phase << 3) + stream->ps.phase_uf;
}
stream->next_uframe = start;
new_stream = true;
}
now = ehci_read_frame_index(ehci) & (mod - 1);
/* Take the isochronous scheduling threshold into account */ if (ehci->i_thresh)
next = now + ehci->i_thresh; /* uframe cache */ else
next = (now + 2 + 7) & ~0x07; /* full frame cache */
/* If needed, initialize last_iso_frame so that this URB will be seen */ if (ehci->isoc_count == 0)
ehci->last_iso_frame = now >> 3;
/* Is the schedule about to wrap around? */ if (unlikely(!empty && start < period)) {
ehci_dbg(ehci, "request %p would overflow (%u-%u < %u mod %u)\n",
urb, stream->next_uframe, base, period, mod);
status = -EFBIG; goto fail;
}
/* Is the next packet scheduled after the base time? */ if (likely(!empty || start <= now2 + period)) {
/* URB_ISO_ASAP: make sure that start >= next */ if (unlikely(start < next &&
(urb->transfer_flags & URB_ISO_ASAP))) goto do_ASAP;
/* Otherwise use start, if it's not in the past */ if (likely(start >= now2)) goto use_start;
/* Otherwise we got an underrun while the queue was empty */
} else { if (urb->transfer_flags & URB_ISO_ASAP) goto do_ASAP;
wrap = mod;
now2 += mod;
}
/* How many uframes and packets do we need to skip? */
skip = (now2 - start + period - 1) & -period; if (skip >= span) { /* Entirely in the past? */
ehci_dbg(ehci, "iso underrun %p (%u+%u < %u) [%u]\n",
urb, start + base, span - period, now2 + base,
base);
/* Try to keep the last TD intact for scanning later */
skip = span - period;
/* Will it come before the current scan position? */ if (empty) {
skip = span; /* Skip the entire URB */
status = 1; /* and give it back immediately */
iso_sched_free(stream, sched);
sched = NULL;
}
}
urb->error_count = skip / period; if (sched)
sched->first_packet = urb->error_count; goto use_start;
do_ASAP: /* Use the first slot after "next" */
start = next + ((start - next) & (period - 1));
use_start: /* Tried to schedule too far into the future? */ if (unlikely(start + span - period >= mod + wrap)) {
ehci_dbg(ehci, "request %p would overflow (%u+%u >= %u)\n",
urb, start, span - period, mod + wrap);
status = -EFBIG; goto fail;
}
staticinlinevoid
itd_link(struct ehci_hcd *ehci, unsigned frame, struct ehci_itd *itd)
{ union ehci_shadow *prev = &ehci->pshadow[frame];
__hc32 *hw_p = &ehci->periodic[frame]; union ehci_shadow here = *prev;
__hc32 type = 0;
/* skip any iso nodes which might belong to previous microframes */ while (here.ptr) {
type = Q_NEXT_TYPE(ehci, *hw_p); if (type == cpu_to_hc32(ehci, Q_TYPE_QH)) break;
prev = periodic_next_shadow(ehci, prev, type);
hw_p = shadow_next_periodic(ehci, &here, type);
here = *prev;
}
/* fit urb's itds into the selected schedule slot; activate as needed */ staticvoid itd_link_urb( struct ehci_hcd *ehci, struct urb *urb, unsigned mod, struct ehci_iso_stream *stream
)
{ int packet; unsigned next_uframe, uframe, frame; struct ehci_iso_sched *iso_sched = urb->hcpriv; struct ehci_itd *itd;
next_uframe = stream->next_uframe & (mod - 1);
if (unlikely(list_empty(&stream->td_list)))
ehci_to_hcd(ehci)->self.bandwidth_allocated
+= stream->bandwidth;
if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { if (ehci->amd_pll_fix == 1)
usb_amd_quirk_pll_disable();
}
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs++;
/* fill iTDs uframe by uframe */ for (packet = iso_sched->first_packet, itd = NULL;
packet < urb->number_of_packets;) { if (itd == NULL) { /* ASSERT: we have all necessary itds */ /* BUG_ON(list_empty(&iso_sched->td_list)); */
/* ASSERT: no itds for this endpoint in this uframe */
/* Process and recycle a completed ITD. Return true iff its urb completed, *andhenceitscompletioncallbackprobablyaddedthingstothehardware *schedule. * *Notethatwecarefullyavoidrecyclingthisdescriptoruntilafterany *completioncallbackruns,sothatitwon'tbereusedquickly.Thatis, *assuming(a)nomorethantwourbsperframeonthisendpoint,andalso *(b)onlythisendpoint'scompletionssubmitURBs.Itseemssomesilicon *corruptsthingsifyoureusecompleteddescriptorsveryquickly...
*/ staticbool itd_complete(struct ehci_hcd *ehci, struct ehci_itd *itd)
{ struct urb *urb = itd->urb; struct usb_iso_packet_descriptor *desc;
u32 t; unsigned uframe; int urb_index = -1; struct ehci_iso_stream *stream = itd->stream; bool retval = false;
/* for each uframe with a packet */ for (uframe = 0; uframe < 8; uframe++) { if (likely(itd->index[uframe] == -1)) continue;
urb_index = itd->index[uframe];
desc = &urb->iso_frame_desc[urb_index];
t = hc32_to_cpup(ehci, &itd->hw_transaction[uframe]);
itd->hw_transaction[uframe] = 0;
/* report transfer status */ if (unlikely(t & ISO_ERRS)) {
urb->error_count++; if (t & EHCI_ISOC_BUF_ERR)
desc->status = usb_pipein(urb->pipe)
? -ENOSR /* hc couldn't read */
: -ECOMM; /* hc couldn't write */ elseif (t & EHCI_ISOC_BABBLE)
desc->status = -EOVERFLOW; else/* (t & EHCI_ISOC_XACTERR) */
desc->status = -EPROTO;
/* HC need not update length with this error */ if (!(t & EHCI_ISOC_BABBLE)) {
desc->actual_length = EHCI_ITD_LENGTH(t);
urb->actual_length += desc->actual_length;
}
} elseif (likely((t & EHCI_ISOC_ACTIVE) == 0)) {
desc->status = 0;
desc->actual_length = EHCI_ITD_LENGTH(t);
urb->actual_length += desc->actual_length;
} else { /* URB was too late */
urb->error_count++;
}
}
/* give urb back to the driver; completion often (re)submits */
ehci_urb_done(ehci, urb, 0);
retval = true;
urb = NULL;
--ehci->isoc_count;
disable_periodic(ehci);
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { if (ehci->amd_pll_fix == 1)
usb_amd_quirk_pll_enable();
}
if (unlikely(list_is_singular(&stream->td_list)))
ehci_to_hcd(ehci)->self.bandwidth_allocated
-= stream->bandwidth;
done:
itd->urb = NULL;
/* Add to the end of the free list for later reuse */
list_move_tail(&itd->itd_list, &stream->free_list);
/* Recycle the iTDs when the pipeline is empty (ep no longer in use) */ if (list_empty(&stream->td_list)) {
list_splice_tail_init(&stream->free_list,
&ehci->cached_itd_list);
start_free_itds(ehci);
}
/* how many frames are needed for these transfers */
iso_sched->span = urb->number_of_packets * stream->ps.period;
/* figure out per-frame sitd fields that we'll need later *whenwefitnewsitdsintotheschedule.
*/ for (i = 0; i < urb->number_of_packets; i++) { struct ehci_iso_packet *packet = &iso_sched->packet[i]; unsigned length;
dma_addr_t buf;
u32 trans;
iso_sched = iso_sched_alloc(urb->number_of_packets, mem_flags); if (iso_sched == NULL) return -ENOMEM;
sitd_sched_init(ehci, iso_sched, stream, urb);
/* allocate/init sITDs */
spin_lock_irqsave(&ehci->lock, flags); for (i = 0; i < urb->number_of_packets; i++) {
/* NOTE: for now, we don't try to handle wraparound cases *forIN(usingsitd->hw_backpointer,likeaFSTN),which *meansweneverneedtwositdsforfullspeedpackets.
*/
/* give urb back to the driver; completion often (re)submits */
ehci_urb_done(ehci, urb, 0);
retval = true;
urb = NULL;
--ehci->isoc_count;
disable_periodic(ehci);
ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; if (ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs == 0) { if (ehci->amd_pll_fix == 1)
usb_amd_quirk_pll_enable();
}
if (list_is_singular(&stream->td_list))
ehci_to_hcd(ehci)->self.bandwidth_allocated
-= stream->bandwidth;
done:
sitd->urb = NULL;
/* Add to the end of the free list for later reuse */
list_move_tail(&sitd->sitd_list, &stream->free_list);
/* Recycle the siTDs when the pipeline is empty (ep no longer in use) */ if (list_empty(&stream->td_list)) {
list_splice_tail_init(&stream->free_list,
&ehci->cached_sitd_list);
start_free_itds(ehci);
}
return retval;
}
staticint sitd_submit(struct ehci_hcd *ehci, struct urb *urb,
gfp_t mem_flags)
{ int status = -EINVAL; unsignedlong flags; struct ehci_iso_stream *stream;
/* Get iso_stream head */
stream = iso_stream_find(ehci, urb); if (stream == NULL) {
ehci_dbg(ehci, "can't get iso stream\n"); return -ENOMEM;
} if (urb->interval != stream->ps.period) {
ehci_dbg(ehci, "can't change iso interval %d --> %d\n",
stream->ps.period, urb->interval); goto done;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.