u64 *l1, *l2;
int bypass, shift;
+ struct lmb io_lmb;
+
dma_addr_t dvabase;
dma_addr_t dvaend;
off = (phys_addr_t)addr - paddr;
psize = ALIGN(size + off, DART_PAGE_SIZE);
- dva = lmb_alloc(psize, DART_PAGE_SIZE);
+ dva = io_lmb_alloc(&priv->io_lmb, psize, DART_PAGE_SIZE);
idx = dva / DART_PAGE_SIZE;
for (i = 0; i < psize / DART_PAGE_SIZE; i++) {
(unsigned long)&priv->l2[idx + i]);
priv->flush_tlb(priv);
- lmb_free(dva, psize);
+ io_lmb_free(&priv->io_lmb, dva, psize);
}
static struct iommu_ops apple_dart_ops = {
dma_addr_t addr;
phys_addr_t l2;
int ntte, nl1, nl2;
- int sid, i;
+ int ret, sid, i;
u32 params2, params4;
priv->base = dev_read_addr_ptr(dev);
priv->dvabase = DART_PAGE_SIZE;
priv->dvaend = SZ_4G - DART_PAGE_SIZE;
- lmb_add(priv->dvabase, priv->dvaend - priv->dvabase);
+ ret = io_lmb_setup(&priv->io_lmb);
+ if (ret)
+ return ret;
+ ret = io_lmb_add(&priv->io_lmb, priv->dvabase,
+ priv->dvaend - priv->dvabase);
+ if (ret)
+ return -EINVAL;
/* Disable translations. */
for (sid = 0; sid < priv->nsid; sid++)
}
priv->flush_tlb(priv);
+ io_lmb_teardown(&priv->io_lmb);
+
return 0;
}