start = largealloc ? tbl->it_largehint : tbl->it_hint;
/* Use only half of the table for small allocs (15 pages or less) */
- limit = largealloc ? tbl->it_mapsize : tbl->it_halfpoint;
+ limit = largealloc ? tbl->it_size : tbl->it_halfpoint;
if (largealloc && start < tbl->it_halfpoint)
start = tbl->it_halfpoint;
* Second failure, rescan the other half of the table.
*/
start = (largealloc ^ pass) ? tbl->it_halfpoint : 0;
- limit = pass ? tbl->it_mapsize : limit;
+ limit = pass ? tbl->it_size : limit;
pass++;
goto again;
} else {
entry = dma_addr >> PAGE_SHIFT;
free_entry = entry - tbl->it_offset;
- if (((free_entry + npages) > tbl->it_mapsize) ||
+ if (((free_entry + npages) > tbl->it_size) ||
(entry < tbl->it_offset)) {
if (printk_ratelimit()) {
printk(KERN_INFO "iommu_free: invalid entry\n");
printk(KERN_INFO "\tdma_addr = 0x%lx\n", (u64)dma_addr);
printk(KERN_INFO "\tTable = 0x%lx\n", (u64)tbl);
printk(KERN_INFO "\tbus# = 0x%lx\n", (u64)tbl->it_busno);
- printk(KERN_INFO "\tmapsize = 0x%lx\n", (u64)tbl->it_mapsize);
+ printk(KERN_INFO "\tsize = 0x%lx\n", (u64)tbl->it_size);
printk(KERN_INFO "\tstartOff = 0x%lx\n", (u64)tbl->it_offset);
printk(KERN_INFO "\tindex = 0x%lx\n", (u64)tbl->it_index);
WARN_ON(1);
unsigned long sz;
static int welcomed = 0;
- /* it_size is in pages, it_mapsize in number of entries */
- tbl->it_mapsize = (tbl->it_size << PAGE_SHIFT) / tbl->it_entrysize;
-
/* Set aside 1/4 of the table for large allocations. */
- tbl->it_halfpoint = tbl->it_mapsize * 3 / 4;
+ tbl->it_halfpoint = tbl->it_size * 3 / 4;
/* number of bytes needed for the bitmap */
- sz = (tbl->it_mapsize + 7) >> 3;
+ sz = (tbl->it_size + 7) >> 3;
tbl->it_map = (unsigned long *)__get_free_pages(GFP_ATOMIC, get_order(sz));
if (!tbl->it_map)
}
/* verify that table contains no entries */
- /* it_mapsize is in entries, and we're examining 64 at a time */
- for (i = 0; i < (tbl->it_mapsize/64); i++) {
+ /* it_size is in entries, and we're examining 64 at a time */
+ for (i = 0; i < (tbl->it_size/64); i++) {
if (tbl->it_map[i] != 0) {
printk(KERN_WARNING "%s: Unexpected TCEs for %s\n",
__FUNCTION__, dn->full_name);
}
/* calculate bitmap size in bytes */
- bitmap_sz = (tbl->it_mapsize + 7) / 8;
+ bitmap_sz = (tbl->it_size + 7) / 8;
/* free bitmap */
order = get_order(bitmap_sz);
* Returns the virtual address of the buffer and sets dma_handle
* to the dma address (mapping) of the first page.
*/
-void *iommu_alloc_consistent(struct iommu_table *tbl, size_t size,
- dma_addr_t *dma_handle)
+void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
+ dma_addr_t *dma_handle, unsigned int __nocast flag)
{
void *ret = NULL;
dma_addr_t mapping;
return NULL;
/* Alloc enough pages (and possibly more) */
- ret = (void *)__get_free_pages(GFP_ATOMIC, order);
+ ret = (void *)__get_free_pages(flag, order);
if (!ret)
return NULL;
memset(ret, 0, size);
return ret;
}
-void iommu_free_consistent(struct iommu_table *tbl, size_t size,
+void iommu_free_coherent(struct iommu_table *tbl, size_t size,
void *vaddr, dma_addr_t dma_handle)
{
unsigned int npages;