33 #include <linux/errno.h>
34 #include <linux/slab.h>
35 #include <linux/bitmap.h>
48 if (obj >= alloc->
max) {
53 if (obj < alloc->
max) {
59 spin_unlock_irqrestore(&alloc->
lock, flags);
68 obj &= alloc->
max - 1;
76 spin_unlock_irqrestore(&alloc->
lock, flags);
85 if (num != 1 << (
ffs(num) - 1))
98 bitmap_zero(alloc->
table, num);
116 #define MTHCA_ARRAY_MASK (PAGE_SIZE / sizeof (void *) - 1)
156 pr_debug(
"Array %p index %d page %d with ref count %d < 0\n",
157 array, index, p, array->
page_list[p].used);
169 for (i = 0; i < npage; ++
i) {
204 if (size <= max_direct) {
218 while (t & ((1 << shift) - 1)) {
227 for (i = 0; i < npages; ++
i)
228 dma_list[i] = t + i * (1 << shift);
243 for (i = 0; i < npages; ++
i)
246 for (i = 0; i < npages; ++
i) {
261 dma_list, shift, npages,