Lines Matching defs:epq

136 	struct isp1362_ep_queue *epq = NULL;
139 epq = &isp1362_hcd->istl_queue[0];
141 epq = &isp1362_hcd->istl_queue[1];
143 epq = &isp1362_hcd->intl_queue;
146 epq = &isp1362_hcd->atl_queue;
148 if (epq)
149 DBG(1, "%s: PTD $%04x is on %s queue\n", __func__, offset, epq->name);
153 return epq;
156 static inline int get_ptd_offset(struct isp1362_ep_queue *epq, u8 index)
160 if (index * epq->blk_size > epq->buf_size) {
162 __func__, epq->name, index,
163 epq->buf_size / epq->blk_size);
166 offset = epq->buf_start + index * epq->blk_size;
167 DBG(3, "%s: %s PTD[%02x] # %04x\n", __func__, epq->name, index, offset);
174 static inline u16 max_transfer_size(struct isp1362_ep_queue *epq, size_t size,
179 xfer_size = min_t(size_t, xfer_size, epq->buf_avail * epq->blk_size - PTD_HEADER_SIZE);
186 static int claim_ptd_buffers(struct isp1362_ep_queue *epq,
190 int num_ptds = ((len + PTD_HEADER_SIZE - 1) / epq->blk_size) + 1;
193 BUG_ON(len > epq->buf_size);
195 if (!epq->buf_avail)
200 epq->name, len, epq->blk_size, num_ptds, epq->buf_map, epq->skip_map);
203 found = bitmap_find_next_zero_area(&epq->buf_map, epq->buf_count, 0,
205 if (found >= epq->buf_count)
209 num_ptds, found, len, (int)(epq->blk_size - PTD_HEADER_SIZE));
210 ptd_offset = get_ptd_offset(epq, found);
214 epq->buf_avail -= num_ptds;
215 BUG_ON(epq->buf_avail > epq->buf_count);
217 bitmap_set(&epq->buf_map, found, num_ptds);
219 __func__, epq->name, ep->ptd_index, ep->ptd_offset,
220 epq->buf_avail, epq->buf_count, num_ptds, epq->buf_map, epq->skip_map);
225 static inline void release_ptd_buffers(struct isp1362_ep_queue *epq, struct isp1362_ep *ep)
229 if (last > epq->buf_count)
231 __func__, ep, ep->num_req, ep->length, epq->name, ep->ptd_index,
232 ep->ptd_offset, ep->num_ptds, epq->buf_count, epq->buf_avail,
233 epq->buf_map, epq->skip_map);
234 BUG_ON(last > epq->buf_count);
236 bitmap_clear(&epq->buf_map, ep->ptd_index, ep->num_ptds);
237 bitmap_set(&epq->skip_map, ep->ptd_index, ep->num_ptds);
238 epq->buf_avail += ep->num_ptds;
239 epq->ptd_count--;
241 BUG_ON(epq->buf_avail > epq->buf_count);
242 BUG_ON(epq->ptd_count > epq->buf_count);
245 __func__, epq->name,
246 ep->ptd_offset, ep->num_ptds, epq->buf_avail, epq->buf_count);
248 epq->buf_map, epq->skip_map);
261 struct isp1362_ep *ep, struct isp1362_ep_queue *epq,
270 DBG(3, "%s: %s ep %p\n", __func__, epq->name, ep);
286 len = max_transfer_size(epq, buf_len, ep->maxpacket);
298 len = max_transfer_size(epq, buf_len, ep->maxpacket);
346 struct isp1362_ep_queue *epq)
362 struct isp1362_ep_queue *epq)
371 DBG(1, "%s: ep %p removed from active list %p\n", __func__, ep, &epq->active);
402 struct isp1362_ep_queue *epq;
407 epq = get_ptd_queue(isp1362_hcd, ep->ptd_offset);
408 BUG_ON(!epq);
422 index, ep->ptd_offset, epq->skip_map, 1 << index);
425 epq->skip_map |= 1 << index;
426 if (epq == &isp1362_hcd->atl_queue) {
428 isp1362_read_reg32(isp1362_hcd, HCATLSKIP), epq->skip_map);
429 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, epq->skip_map);
430 if (~epq->skip_map == 0)
432 } else if (epq == &isp1362_hcd->intl_queue) {
434 isp1362_read_reg32(isp1362_hcd, HCINTLSKIP), epq->skip_map);
435 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, epq->skip_map);
436 if (~epq->skip_map == 0)
659 struct isp1362_ep_queue *epq =
663 BUG_ON(epq == NULL);
667 release_ptd_buffers(epq, ep);
714 struct isp1362_ep *ep, struct isp1362_ep_queue *epq)
718 prepare_ptd(isp1362_hcd, urb, ep, epq, 0);
719 index = claim_ptd_buffers(epq, ep, ep->length);
722 ep->num_req, epq->name, ep->num_ptds, epq->buf_map, epq->skip_map);
726 __func__, ep->num_req, ep->length, epq->name, ep->num_ptds,
727 epq->buf_map, epq->skip_map);
731 list_add_tail(&ep->active, &epq->active);
733 ep, ep->num_req, ep->length, &epq->active);
734 DBG(1, "%s: Submitting %s PTD $%04x for ep %p req %d\n", __func__, epq->name,
736 isp1362_write_ptd(isp1362_hcd, ep, epq);
737 __clear_bit(ep->ptd_index, &epq->skip_map);
745 struct isp1362_ep_queue *epq = &isp1362_hcd->atl_queue;
749 if (atomic_read(&epq->finishing)) {
750 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
759 DBG(2, "%s: Skipping active %s ep %p\n", __func__, epq->name, ep);
763 DBG(1, "%s: Processing %s ep %p req %d\n", __func__, epq->name,
766 ret = submit_req(isp1362_hcd, urb, ep, epq);
788 epq->ptd_count += ptd_count;
789 if (epq->ptd_count > epq->stat_maxptds) {
790 epq->stat_maxptds = epq->ptd_count;
791 DBG(0, "%s: max_ptds: %d\n", __func__, epq->stat_maxptds);
798 struct isp1362_ep_queue *epq = &isp1362_hcd->intl_queue;
801 if (atomic_read(&epq->finishing)) {
802 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
812 epq->name, ep);
817 epq->name, ep, ep->num_req);
818 ret = submit_req(isp1362_hcd, urb, ep, epq);
836 epq->ptd_count += ptd_count;
837 if (epq->ptd_count > epq->stat_maxptds)
838 epq->stat_maxptds = epq->ptd_count;
841 static inline int next_ptd(struct isp1362_ep_queue *epq, struct isp1362_ep *ep)
844 int num_ptds = (ep->length + PTD_HEADER_SIZE + (epq->blk_size - 1)) / epq->blk_size;
847 ep->length, num_ptds, epq->blk_size, ptd_offset + num_ptds * epq->blk_size);
849 ptd_offset += num_ptds * epq->blk_size;
850 if (ptd_offset < epq->buf_start + epq->buf_size)
860 struct isp1362_ep_queue *epq;
867 epq = &isp1362_hcd->istl_queue[flip];
868 if (atomic_read(&epq->finishing)) {
869 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
873 if (!list_empty(&epq->active))
876 ptd_offset = epq->buf_start;
881 DBG(1, "%s: Processing %s ep %p\n", __func__, epq->name, ep);
895 prepare_ptd(isp1362_hcd, urb, ep, epq, fno);
897 epq->buf_start + epq->buf_size) {
903 list_add_tail(&ep->active, &epq->active);
905 ptd_offset = next_ptd(epq, ep);
908 __func__, ep->num_req, epq->name);
913 list_for_each_entry(ep, &epq->active, active) {
914 if (epq->active.next == &ep->active)
916 isp1362_write_ptd(isp1362_hcd, ep, epq);
923 epq->ptd_count += ptd_count;
924 if (epq->ptd_count > epq->stat_maxptds)
925 epq->stat_maxptds = epq->ptd_count;
938 struct isp1362_ep_queue *epq)
943 if (list_empty(&epq->active)) {
944 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name);
948 DBG(1, "%s: Finishing %s transfers %08lx\n", __func__, epq->name, done_map);
950 atomic_inc(&epq->finishing);
951 list_for_each_entry_safe(ep, tmp, &epq->active, active) {
954 DBG(1, "%s: Checking %s PTD[%02x] $%04x\n", __func__, epq->name,
959 isp1362_read_ptd(isp1362_hcd, ep, epq);
960 epq->free_ptd = index;
962 release_ptd_buffers(epq, ep);
970 DBG(1, "%s: Postprocessing %s ep %p req %d\n", __func__, epq->name,
979 __func__, done_map, epq->skip_map);
980 atomic_dec(&epq->finishing);
983 static void finish_iso_transfers(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep_queue *epq)
988 if (list_empty(&epq->active)) {
989 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name);
993 DBG(1, "%s: Finishing %s transfers\n", __func__, epq->name);
995 atomic_inc(&epq->finishing);
996 list_for_each_entry_safe(ep, tmp, &epq->active, active) {
999 isp1362_read_ptd(isp1362_hcd, ep, epq);
1000 DBG(1, "%s: Postprocessing %s ep %p\n", __func__, epq->name, ep);
1003 WARN_ON(epq->blk_size != 0);
1004 atomic_dec(&epq->finishing);