17 #include <linux/module.h>
21 #define wait_for_value(val) \
22 __asm__ __volatile__("move %0, %0" :: "r"(val))
25 #define DMA_QUEUE_INDEX_MASK ((1 << 16) - 1)
35 #ifndef __BIG_ENDIAN__
57 int64_t credits = (num_entries < 65536) ? num_entries : 65535;
59 memset(dma_queue, 0,
sizeof(*dma_queue));
62 dma_queue->hw_complete_count = 0;
81 cmpxchg(&dma_queue->hw_complete_count,
96 delta = (count - orig_hw_complete_count) & 0xffff;
106 new_count = orig_hw_complete_count +
delta;
107 if (
cmpxchg(&dma_queue->hw_complete_count,
108 orig_hw_complete_count,
109 new_count) != orig_hw_complete_count)
136 for (i = backoff; i > 0; i--)
147 }
while (old + modifier < 0);
155 unsigned int num,
int wait)
157 return __gxio_dma_queue_reserve(dma_queue, num, wait != 0,
true);
163 int64_t completion_slot,
int update)
173 return ACCESS_ONCE(dma_queue->hw_complete_count) > completion_slot;