Lines Matching refs:chan
54 struct ioat_chan_common *chan = &ioat->base; in __ioat2_issue_pending() local
58 writew(ioat->dmacount, chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET); in __ioat2_issue_pending()
59 dev_dbg(to_dev(chan), in __ioat2_issue_pending()
129 struct ioat_chan_common *chan = &ioat->base; in __cleanup() local
136 dev_dbg(to_dev(chan), "%s: head: %#x tail: %#x issued: %#x\n", in __cleanup()
162 chan->last_completion = phys_complete; in __cleanup()
164 dev_dbg(to_dev(chan), "%s: cancel completion timeout\n", in __cleanup()
166 clear_bit(IOAT_COMPLETION_PENDING, &chan->state); in __cleanup()
167 mod_timer(&chan->timer, jiffies + IDLE_TIMEOUT); in __cleanup()
177 struct ioat_chan_common *chan = &ioat->base; in ioat2_cleanup() local
180 spin_lock_bh(&chan->cleanup_lock); in ioat2_cleanup()
181 if (ioat_cleanup_preamble(chan, &phys_complete)) in ioat2_cleanup()
183 spin_unlock_bh(&chan->cleanup_lock); in ioat2_cleanup()
189 struct ioat_chan_common *chan = &ioat->base; in ioat2_cleanup_event() local
192 if (!test_bit(IOAT_RUN, &chan->state)) in ioat2_cleanup_event()
199 struct ioat_chan_common *chan = &ioat->base; in __ioat2_restart_chan() local
204 set_bit(IOAT_COMPLETION_PENDING, &chan->state); in __ioat2_restart_chan()
205 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in __ioat2_restart_chan()
207 dev_dbg(to_dev(chan), in __ioat2_restart_chan()
221 int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo) in ioat2_quiesce() argument
227 status = ioat_chansts(chan); in ioat2_quiesce()
229 ioat_suspend(chan); in ioat2_quiesce()
235 status = ioat_chansts(chan); in ioat2_quiesce()
242 int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo) in ioat2_reset_sync() argument
247 ioat_reset(chan); in ioat2_reset_sync()
248 while (ioat_reset_pending(chan)) { in ioat2_reset_sync()
261 struct ioat_chan_common *chan = &ioat->base; in ioat2_restart_channel() local
264 ioat2_quiesce(chan, 0); in ioat2_restart_channel()
265 if (ioat_cleanup_preamble(chan, &phys_complete)) in ioat2_restart_channel()
273 struct ioat_chan_common *chan = &ioat->base; in check_active() local
276 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in check_active()
280 if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &chan->state)) in check_active()
281 mod_timer(&chan->timer, jiffies + IDLE_TIMEOUT); in check_active()
292 mod_timer(&chan->timer, jiffies + IDLE_TIMEOUT); in check_active()
300 struct ioat_chan_common *chan = &ioat->base; in ioat2_timer_event() local
304 status = ioat_chansts(chan); in ioat2_timer_event()
312 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); in ioat2_timer_event()
313 dev_err(to_dev(chan), "%s: Channel halted (%x)\n", in ioat2_timer_event()
315 if (test_bit(IOAT_RUN, &chan->state)) in ioat2_timer_event()
325 spin_lock_bh(&chan->cleanup_lock); in ioat2_timer_event()
326 if (ioat_cleanup_preamble(chan, &phys_complete)) in ioat2_timer_event()
328 else if (test_bit(IOAT_COMPLETION_ACK, &chan->state)) { in ioat2_timer_event()
332 spin_unlock_bh(&chan->cleanup_lock); in ioat2_timer_event()
335 set_bit(IOAT_COMPLETION_ACK, &chan->state); in ioat2_timer_event()
336 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in ioat2_timer_event()
341 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in ioat2_timer_event()
347 spin_unlock_bh(&chan->cleanup_lock); in ioat2_timer_event()
350 static int ioat2_reset_hw(struct ioat_chan_common *chan) in ioat2_reset_hw() argument
355 ioat2_quiesce(chan, msecs_to_jiffies(100)); in ioat2_reset_hw()
357 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); in ioat2_reset_hw()
358 writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET); in ioat2_reset_hw()
360 return ioat2_reset_sync(chan, msecs_to_jiffies(200)); in ioat2_reset_hw()
413 struct dma_chan *c = tx->chan; in ioat2_tx_submit_unlock()
415 struct ioat_chan_common *chan = &ioat->base; in ioat2_tx_submit_unlock() local
421 if (!test_and_set_bit(IOAT_CHAN_ACTIVE, &chan->state)) in ioat2_tx_submit_unlock()
422 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in ioat2_tx_submit_unlock()
438 static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t flags) in ioat2_alloc_ring_ent() argument
445 dma = to_ioatdma_device(chan->device); in ioat2_alloc_ring_ent()
457 dma_async_tx_descriptor_init(&desc->txd, chan); in ioat2_alloc_ring_ent()
464 static void ioat2_free_ring_ent(struct ioat_ring_ent *desc, struct dma_chan *chan) in ioat2_free_ring_ent() argument
468 dma = to_ioatdma_device(chan->device); in ioat2_free_ring_ent()
517 struct ioat_chan_common *chan = &ioat->base; in ioat2_alloc_chan_resources() local
528 writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET); in ioat2_alloc_chan_resources()
532 chan->completion = pci_pool_alloc(chan->device->completion_pool, in ioat2_alloc_chan_resources()
533 GFP_KERNEL, &chan->completion_dma); in ioat2_alloc_chan_resources()
534 if (!chan->completion) in ioat2_alloc_chan_resources()
537 memset(chan->completion, 0, sizeof(*chan->completion)); in ioat2_alloc_chan_resources()
538 writel(((u64) chan->completion_dma) & 0x00000000FFFFFFFF, in ioat2_alloc_chan_resources()
539 chan->reg_base + IOAT_CHANCMP_OFFSET_LOW); in ioat2_alloc_chan_resources()
540 writel(((u64) chan->completion_dma) >> 32, in ioat2_alloc_chan_resources()
541 chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); in ioat2_alloc_chan_resources()
548 spin_lock_bh(&chan->cleanup_lock); in ioat2_alloc_chan_resources()
555 set_bit(IOAT_RUN, &chan->state); in ioat2_alloc_chan_resources()
557 spin_unlock_bh(&chan->cleanup_lock); in ioat2_alloc_chan_resources()
564 status = ioat_chansts(chan); in ioat2_alloc_chan_resources()
570 u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); in ioat2_alloc_chan_resources()
572 dev_WARN(to_dev(chan), in ioat2_alloc_chan_resources()
585 struct ioat_chan_common *chan = &ioat->base; in reshape_ring() local
586 struct dma_chan *c = &chan->common; in reshape_ring()
676 dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", in reshape_ring()
693 struct ioat_chan_common *chan = &ioat->base; in ioat2_check_space_lock() local
703 dev_dbg(to_dev(chan), "%s: num_descs: %d (%x:%x:%x)\n", in ioat2_check_space_lock()
708 retry = test_and_set_bit(IOAT_RESHAPE_PENDING, &chan->state); in ioat2_check_space_lock()
715 spin_lock_bh(&chan->cleanup_lock); in ioat2_check_space_lock()
718 clear_bit(IOAT_RESHAPE_PENDING, &chan->state); in ioat2_check_space_lock()
720 spin_unlock_bh(&chan->cleanup_lock); in ioat2_check_space_lock()
727 dev_dbg(to_dev(chan), "%s: ring full! num_descs: %d (%x:%x:%x)\n", in ioat2_check_space_lock()
734 if (time_is_before_jiffies(chan->timer.expires) in ioat2_check_space_lock()
735 && timer_pending(&chan->timer)) { in ioat2_check_space_lock()
736 struct ioatdma_device *device = chan->device; in ioat2_check_space_lock()
738 mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); in ioat2_check_space_lock()
739 device->timer_fn((unsigned long) &chan->common); in ioat2_check_space_lock()
798 struct ioat_chan_common *chan = &ioat->base; in ioat2_free_chan_resources() local
799 struct ioatdma_device *device = chan->device; in ioat2_free_chan_resources()
811 ioat_stop(chan); in ioat2_free_chan_resources()
812 device->reset_hw(chan); in ioat2_free_chan_resources()
814 spin_lock_bh(&chan->cleanup_lock); in ioat2_free_chan_resources()
817 dev_dbg(to_dev(chan), "freeing %d idle descriptors\n", descs); in ioat2_free_chan_resources()
824 dev_err(to_dev(chan), "Freeing %d in use descriptors!\n", in ioat2_free_chan_resources()
836 pci_pool_free(device->completion_pool, chan->completion, in ioat2_free_chan_resources()
837 chan->completion_dma); in ioat2_free_chan_resources()
839 spin_unlock_bh(&chan->cleanup_lock); in ioat2_free_chan_resources()
841 chan->last_completion = 0; in ioat2_free_chan_resources()
842 chan->completion_dma = 0; in ioat2_free_chan_resources()
881 struct ioat_chan_common *chan; in ioat2_dma_probe() local
901 chan = to_chan_common(c); in ioat2_dma_probe()
903 chan->reg_base + IOAT_DCACTRL_OFFSET); in ioat2_dma_probe()