Lines Matching defs:epq
140 struct isp1362_ep_queue *epq = NULL;
143 epq = &isp1362_hcd->istl_queue[0];
145 epq = &isp1362_hcd->istl_queue[1];
147 epq = &isp1362_hcd->intl_queue;
150 epq = &isp1362_hcd->atl_queue;
152 if (epq)
153 DBG(1, "%s: PTD $%04x is on %s queue\n", __func__, offset, epq->name);
157 return epq;
160 static inline int get_ptd_offset(struct isp1362_ep_queue *epq, u8 index)
164 if (index * epq->blk_size > epq->buf_size) {
165 pr_warning("%s: Bad %s index %d(%d)\n", __func__, epq->name, index,
166 epq->buf_size / epq->blk_size);
169 offset = epq->buf_start + index * epq->blk_size;
170 DBG(3, "%s: %s PTD[%02x] # %04x\n", __func__, epq->name, index, offset);
177 static inline u16 max_transfer_size(struct isp1362_ep_queue *epq, size_t size,
182 xfer_size = min_t(size_t, xfer_size, epq->buf_avail * epq->blk_size - PTD_HEADER_SIZE);
189 static int claim_ptd_buffers(struct isp1362_ep_queue *epq,
193 int num_ptds = ((len + PTD_HEADER_SIZE - 1) / epq->blk_size) + 1;
196 BUG_ON(len > epq->buf_size);
198 if (!epq->buf_avail)
203 epq->name, len, epq->blk_size, num_ptds, epq->buf_map, epq->skip_map);
206 found = bitmap_find_next_zero_area(&epq->buf_map, epq->buf_count, 0,
208 if (found >= epq->buf_count)
212 num_ptds, found, len, (int)(epq->blk_size - PTD_HEADER_SIZE));
213 ptd_offset = get_ptd_offset(epq, found);
217 epq->buf_avail -= num_ptds;
218 BUG_ON(epq->buf_avail > epq->buf_count);
220 bitmap_set(&epq->buf_map, found, num_ptds);
222 __func__, epq->name, ep->ptd_index, ep->ptd_offset,
223 epq->buf_avail, epq->buf_count, num_ptds, epq->buf_map, epq->skip_map);
228 static inline void release_ptd_buffers(struct isp1362_ep_queue *epq, struct isp1362_ep *ep)
233 if (last > epq->buf_count)
235 __func__, ep, ep->num_req, ep->length, epq->name, ep->ptd_index,
236 ep->ptd_offset, ep->num_ptds, epq->buf_count, epq->buf_avail,
237 epq->buf_map, epq->skip_map);
238 BUG_ON(last > epq->buf_count);
241 __clear_bit(index, &epq->buf_map);
242 __set_bit(index, &epq->skip_map);
244 epq->buf_avail += ep->num_ptds;
245 epq->ptd_count--;
247 BUG_ON(epq->buf_avail > epq->buf_count);
248 BUG_ON(epq->ptd_count > epq->buf_count);
251 __func__, epq->name,
252 ep->ptd_offset, ep->num_ptds, epq->buf_avail, epq->buf_count);
254 epq->buf_map, epq->skip_map);
267 struct isp1362_ep *ep, struct isp1362_ep_queue *epq,
276 DBG(3, "%s: %s ep %p\n", __func__, epq->name, ep);
292 len = max_transfer_size(epq, buf_len, ep->maxpacket);
304 len = max_transfer_size(epq, buf_len, ep->maxpacket);
352 struct isp1362_ep_queue *epq)
370 struct isp1362_ep_queue *epq)
379 DBG(1, "%s: ep %p removed from active list %p\n", __func__, ep, &epq->active);
410 struct isp1362_ep_queue *epq;
415 epq = get_ptd_queue(isp1362_hcd, ep->ptd_offset);
416 BUG_ON(!epq);
430 index, ep->ptd_offset, epq->skip_map, 1 << index);
433 epq->skip_map |= 1 << index;
434 if (epq == &isp1362_hcd->atl_queue) {
436 isp1362_read_reg32(isp1362_hcd, HCATLSKIP), epq->skip_map);
437 isp1362_write_reg32(isp1362_hcd, HCATLSKIP, epq->skip_map);
438 if (~epq->skip_map == 0)
440 } else if (epq == &isp1362_hcd->intl_queue) {
442 isp1362_read_reg32(isp1362_hcd, HCINTLSKIP), epq->skip_map);
443 isp1362_write_reg32(isp1362_hcd, HCINTLSKIP, epq->skip_map);
444 if (~epq->skip_map == 0)
667 struct isp1362_ep_queue *epq =
671 BUG_ON(epq == NULL);
675 release_ptd_buffers(epq, ep);
722 struct isp1362_ep *ep, struct isp1362_ep_queue *epq)
724 int index = epq->free_ptd;
726 prepare_ptd(isp1362_hcd, urb, ep, epq, 0);
727 index = claim_ptd_buffers(epq, ep, ep->length);
730 ep->num_req, epq->name, ep->num_ptds, epq->buf_map, epq->skip_map);
734 __func__, ep->num_req, ep->length, epq->name, ep->num_ptds,
735 epq->buf_map, epq->skip_map);
739 list_add_tail(&ep->active, &epq->active);
741 ep, ep->num_req, ep->length, &epq->active);
742 DBG(1, "%s: Submitting %s PTD $%04x for ep %p req %d\n", __func__, epq->name,
744 isp1362_write_ptd(isp1362_hcd, ep, epq);
745 __clear_bit(ep->ptd_index, &epq->skip_map);
753 struct isp1362_ep_queue *epq = &isp1362_hcd->atl_queue;
757 if (atomic_read(&epq->finishing)) {
758 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
767 DBG(2, "%s: Skipping active %s ep %p\n", __func__, epq->name, ep);
771 DBG(1, "%s: Processing %s ep %p req %d\n", __func__, epq->name,
774 ret = submit_req(isp1362_hcd, urb, ep, epq);
796 epq->ptd_count += ptd_count;
797 if (epq->ptd_count > epq->stat_maxptds) {
798 epq->stat_maxptds = epq->ptd_count;
799 DBG(0, "%s: max_ptds: %d\n", __func__, epq->stat_maxptds);
806 struct isp1362_ep_queue *epq = &isp1362_hcd->intl_queue;
809 if (atomic_read(&epq->finishing)) {
810 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
820 epq->name, ep);
825 epq->name, ep, ep->num_req);
826 ret = submit_req(isp1362_hcd, urb, ep, epq);
844 epq->ptd_count += ptd_count;
845 if (epq->ptd_count > epq->stat_maxptds)
846 epq->stat_maxptds = epq->ptd_count;
849 static inline int next_ptd(struct isp1362_ep_queue *epq, struct isp1362_ep *ep)
852 int num_ptds = (ep->length + PTD_HEADER_SIZE + (epq->blk_size - 1)) / epq->blk_size;
855 ep->length, num_ptds, epq->blk_size, ptd_offset + num_ptds * epq->blk_size);
857 ptd_offset += num_ptds * epq->blk_size;
858 if (ptd_offset < epq->buf_start + epq->buf_size)
868 struct isp1362_ep_queue *epq;
875 epq = &isp1362_hcd->istl_queue[flip];
876 if (atomic_read(&epq->finishing)) {
877 DBG(1, "%s: finish_transfers is active for %s\n", __func__, epq->name);
881 if (!list_empty(&epq->active))
884 ptd_offset = epq->buf_start;
889 DBG(1, "%s: Processing %s ep %p\n", __func__, epq->name, ep);
903 prepare_ptd(isp1362_hcd, urb, ep, epq, fno);
905 epq->buf_start + epq->buf_size) {
911 list_add_tail(&ep->active, &epq->active);
913 ptd_offset = next_ptd(epq, ep);
916 ep->num_req, epq->name);
921 list_for_each_entry(ep, &epq->active, active) {
922 if (epq->active.next == &ep->active)
924 isp1362_write_ptd(isp1362_hcd, ep, epq);
931 epq->ptd_count += ptd_count;
932 if (epq->ptd_count > epq->stat_maxptds)
933 epq->stat_maxptds = epq->ptd_count;
946 struct isp1362_ep_queue *epq)
951 if (list_empty(&epq->active)) {
952 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name);
956 DBG(1, "%s: Finishing %s transfers %08lx\n", __func__, epq->name, done_map);
958 atomic_inc(&epq->finishing);
959 list_for_each_entry_safe(ep, tmp, &epq->active, active) {
962 DBG(1, "%s: Checking %s PTD[%02x] $%04x\n", __func__, epq->name,
967 isp1362_read_ptd(isp1362_hcd, ep, epq);
968 epq->free_ptd = index;
970 release_ptd_buffers(epq, ep);
978 DBG(1, "%s: Postprocessing %s ep %p req %d\n", __func__, epq->name,
987 epq->skip_map);
988 atomic_dec(&epq->finishing);
991 static void finish_iso_transfers(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep_queue *epq)
996 if (list_empty(&epq->active)) {
997 DBG(1, "%s: Nothing to do for %s queue\n", __func__, epq->name);
1001 DBG(1, "%s: Finishing %s transfers\n", __func__, epq->name);
1003 atomic_inc(&epq->finishing);
1004 list_for_each_entry_safe(ep, tmp, &epq->active, active) {
1007 isp1362_read_ptd(isp1362_hcd, ep, epq);
1008 DBG(1, "%s: Postprocessing %s ep %p\n", __func__, epq->name, ep);
1011 WARN_ON(epq->blk_size != 0);
1012 atomic_dec(&epq->finishing);