/* alignment check */
if (!is_aligned(size, SZ_64K)) {
dev_err(&mmu->dev,
- "omapdsp: size(0x%lx) is not multiple of 64KB.\n",
- size);
+ "MMU %s: size(0x%lx) is not multiple of 64KB.\n",
+ mmu->name, size);
return -EINVAL;
}
if (size > (1 << mmu->addrspace)) {
dev_err(&mmu->dev,
- "omapdsp: size(0x%lx) is larger than DSP memory space "
- "size (0x%x.\n", size, (1 << mmu->addrspace));
+ "MMU %s: size(0x%lx) is larger than external device "
+ " memory space size (0x%x.\n", mmu->name, size,
+ (1 << mmu->addrspace));
return -EINVAL;
}
int prot_pmd, prot_pte;
dev_dbg(&mmu->dev,
- "MMU: mapping in ARM MMU, v=0x%08lx, p=0x%08lx, sz=0x%lx\n",
- virt, phys, size);
+ "MMU %s: mapping in ARM MMU, v=0x%08lx, p=0x%08lx, sz=0x%lx\n",
+ mmu->name, virt, phys, size);
prot_pmd = PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_IO);
prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_WRITE;
pte_t *ptep;
dev_dbg(&mmu->dev,
- "MMU: unmapping in ARM MMU, v=0x%08lx, sz=0x%lx\n",
- virt, size);
+ "MMU %s: unmapping in ARM MMU, v=0x%08lx, sz=0x%lx\n",
+ mmu->name, virt, size);
for (sz_left = size;
sz_left >= PAGE_SIZE;
found_victim:
/* The last entry cannot be locked? */
if (lock.victim == (mmu->nr_tlb_entries - 1)) {
- dev_err(&mmu->dev, "MMU: TLB is full.\n");
+ dev_err(&mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
return -EBUSY;
}
* omap_mmu_exmap()
*
* MEM_IOCTL_EXMAP ioctl calls this function with padr=0.
- * In this case, the buffer for DSP is allocated in this routine,
+ * In this case, the buffer for external device is allocated in this routine,
* then it is mapped.
* On the other hand, for example - frame buffer sharing, calls
* this function with padr set. It means some known address space
- * pointed with padr is going to be shared with DSP.
+ * pointed with padr is going to be shared with external device.
*/
-int omap_mmu_exmap(struct omap_mmu *mmu, unsigned long dspadr,
+int omap_mmu_exmap(struct omap_mmu *mmu, unsigned long devadr,
unsigned long padr, unsigned long size,
enum exmap_type type)
{
unsigned int order = 0;
unsigned long unit;
int prev = -1;
- unsigned long _dspadr = dspadr;
+ unsigned long _devadr = devadr;
unsigned long _padr = padr;
- void *_vadr = omap_mmu_to_virt(mmu, dspadr);
+ void *_vadr = omap_mmu_to_virt(mmu, devadr);
unsigned long _size = size;
struct omap_mmu_tlb_entry tlb_ent;
struct exmap_tbl *exmap_ent, *tmp_ent;
*/
if (!is_aligned(size, MINIMUM_PAGESZ)) {
dev_err(&mmu->dev,
- "MMU: size(0x%lx) is not multiple of 4KB.\n", size);
+ "MMU %s: size(0x%lx) is not multiple of 4KB.\n",
+ mmu->name, size);
return -EINVAL;
}
- if (!is_aligned(dspadr, MINIMUM_PAGESZ)) {
+ if (!is_aligned(devadr, MINIMUM_PAGESZ)) {
dev_err(&mmu->dev,
- "MMU: DSP address(0x%lx) is not aligned.\n", dspadr);
+ "MMU %s: external device address(0x%lx) is not"
+ " aligned.\n", mmu->name, devadr);
return -EINVAL;
}
if (!is_aligned(padr, MINIMUM_PAGESZ)) {
dev_err(&mmu->dev,
- "MMU: physical address(0x%lx) is not aligned.\n",
- padr);
+ "MMU %s: physical address(0x%lx) is not aligned.\n",
+ mmu->name, padr);
return -EINVAL;
}
/* address validity check */
- if ((dspadr < mmu->memsize) ||
- (dspadr >= (1 << mmu->addrspace))) {
+ if ((devadr < mmu->memsize) ||
+ (devadr >= (1 << mmu->addrspace))) {
dev_err(&mmu->dev,
- "MMU: illegal address/size for %s().\n",
- __FUNCTION__);
+ "MMU %s: illegal address/size for %s().\n",
+ mmu->name, __FUNCTION__);
return -EINVAL;
}
mapsize = 1 << (tmp_ent->order + PAGE_SHIFT);
if ((_vadr + size > tmp_ent->vadr) &&
(_vadr < tmp_ent->vadr + mapsize)) {
- dev_err(&mmu->dev, "MMU: exmap page overlap!\n");
+ dev_err(&mmu->dev, "MMU %s: exmap page overlap!\n",
+ mmu->name);
up_write(&mmu->exmap_sem);
return -EINVAL;
}
if (!mmu->exmap_tbl[idx].valid)
goto found_free;
- dev_err(&mmu->dev, "MMU: DSP TLB is full.\n");
+ dev_err(&mmu->dev, "MMU %s: TLB is full.\n", mmu->name);
status = -EBUSY;
goto fail;
if ((_size >= SZ_1M) &&
(is_aligned(_padr, SZ_1M) || (padr == 0)) &&
- is_aligned(_dspadr, SZ_1M)) {
+ is_aligned(_devadr, SZ_1M)) {
unit = SZ_1M;
pgsz = OMAP_MMU_CAM_PAGESIZE_1MB;
} else if ((_size >= SZ_64K) &&
(is_aligned(_padr, SZ_64K) || (padr == 0)) &&
- is_aligned(_dspadr, SZ_64K)) {
+ is_aligned(_devadr, SZ_64K)) {
unit = SZ_64K;
pgsz = OMAP_MMU_CAM_PAGESIZE_64KB;
} else {
if (status < 0)
goto fail;
- /* loading DSP PTE entry */
- INIT_TLB_ENTRY(&tlb_ent, _dspadr, _padr, pgsz);
+ /* loading external device PTE entry */
+ INIT_TLB_ENTRY(&tlb_ent, _devadr, _padr, pgsz);
status = omap_mmu_load_pte_entry(mmu, &tlb_ent);
if (status < 0) {
exmap_clear_armmmu(mmu, (unsigned long)_vadr, unit);
return size;
}
- _dspadr += unit;
+ _devadr += unit;
_vadr += unit;
_padr = padr ? _padr + unit : 0;
prev = idx;
up_write(&mmu->exmap_sem);
if (buf)
omap_mmu_free_pages((unsigned long)buf, order);
- omap_mmu_exunmap(mmu, dspadr);
+ omap_mmu_exunmap(mmu, devadr);
return status;
}
EXPORT_SYMBOL_GPL(omap_mmu_exmap);
/* freeing allocated memory */
if (ent->type == EXMAP_TYPE_MEM) {
omap_mmu_free_pages((unsigned long)ent->buf, ent->order);
- dev_dbg(&mmu->dev, "MMU: freeing 0x%lx bytes @ adr 0x%8p\n",
- size, ent->buf);
+ dev_dbg(&mmu->dev, "MMU %s: freeing 0x%lx bytes @ adr 0x%8p\n",
+ mmu->name, size, ent->buf);
}
ent->valid = 0;
return size;
}
-int omap_mmu_exunmap(struct omap_mmu *mmu, unsigned long dspadr)
+int omap_mmu_exunmap(struct omap_mmu *mmu, unsigned long devadr)
{
void *vadr;
unsigned long size;
struct exmap_tbl *ent;
int idx;
- vadr = omap_mmu_to_virt(mmu, dspadr);
+ vadr = omap_mmu_to_virt(mmu, devadr);
down_write(&mmu->exmap_sem);
for (idx = 0; idx < mmu->nr_tlb_entries; idx++) {
ent = mmu->exmap_tbl + idx;
goto found_map;
}
up_write(&mmu->exmap_sem);
- dev_warn(&mmu->dev, "MMU: address %06lx not found in exmap_tbl.\n",
- dspadr);
+ dev_warn(&mmu->dev, "MMU %s: address %06lx not found in exmap_tbl.\n",
+ mmu->name, devadr);
return -EINVAL;
found_map:
if (ent->usecount > 0) {
- dev_err(&mmu->dev, "MMU: exmap reference count is not 0.\n"
+ dev_err(&mmu->dev, "MMU %s: exmap reference count is not 0.\n"
" idx=%d, vadr=%p, order=%d, usecount=%d\n",
- idx, ent->vadr, ent->order, ent->usecount);
+ mmu->name, idx, ent->vadr, ent->order, ent->usecount);
up_write(&mmu->exmap_sem);
return -EINVAL;
}
- /* clearing DSP PTE entry */
- omap_mmu_clear_pte_entry(mmu, dspadr);
+ /* clearing external device PTE entry */
+ omap_mmu_clear_pte_entry(mmu, devadr);
/* clear ARM MMU and free buffer */
size = unmap_free_arm(mmu, ent);
if (idx < 0)
goto up_out; /* normal completion */
ent = mmu->exmap_tbl + idx;
- dspadr += size;
+ devadr += size;
vadr += size;
if (ent->vadr == vadr)
goto found_map; /* continue */
- dev_err(&mmu->dev, "MMU: illegal exmap_tbl grouping!\n"
+ dev_err(&mmu->dev, "MMU %s: illegal exmap_tbl grouping!\n"
"expected vadr = %p, exmap_tbl[%d].vadr = %p\n",
- vadr, idx, ent->vadr);
+ mmu->name, vadr, idx, ent->vadr);
up_write(&mmu->exmap_sem);
return -EINVAL;
EXPORT_SYMBOL_GPL(omap_mmu_exmap_flush);
void exmap_setup_preserved_mem_page(struct omap_mmu *mmu, void *buf,
- unsigned long dspadr, int index)
+ unsigned long devadr, int index)
{
unsigned long phys;
void *virt;
struct omap_mmu_tlb_entry tlb_ent;
phys = __pa(buf);
- virt = omap_mmu_to_virt(mmu, dspadr);
+ virt = omap_mmu_to_virt(mmu, devadr);
exmap_set_armmmu(mmu, (unsigned long)virt, phys, PAGE_SIZE);
INIT_EXMAP_TBL_ENTRY_4KB_PRESERVED(mmu->exmap_tbl + index, buf, virt);
- INIT_TLB_ENTRY_4KB_PRESERVED(&tlb_ent, dspadr, phys);
+ INIT_TLB_ENTRY_4KB_PRESERVED(&tlb_ent, devadr, phys);
omap_mmu_load_pte_entry(mmu, &tlb_ent);
}
EXPORT_SYMBOL_GPL(exmap_setup_preserved_mem_page);
-void exmap_clear_mem_page(struct omap_mmu *mmu, unsigned long dspadr)
+void exmap_clear_mem_page(struct omap_mmu *mmu, unsigned long devadr)
{
- void *virt = omap_mmu_to_virt(mmu, dspadr);
+ void *virt = omap_mmu_to_virt(mmu, devadr);
exmap_clear_armmmu(mmu, (unsigned long)virt, PAGE_SIZE);
/* DSP MMU is shutting down. not handled here. */
ret = request_irq(mmu->irq, omap_mmu_interrupt, IRQF_DISABLED,
mmu->name, mmu);
if (ret < 0) {
- dev_err(&mmu->dev, "failed to register MMU interrupt: %d\n",
- ret);
+ dev_err(&mmu->dev, "MMU %s: failed to register MMU interrupt:"
+ " %d\n", mmu->name, ret);
goto fail;
}
void *vadr = omap_mmu_to_virt(mmu, p);
if (!exmap_valid(mmu, vadr, count)) {
- dev_err(&mmu->dev, "MMU: DSP address %08lx / size %08x "
- "is not valid!\n", p, count);
+ dev_err(&mmu->dev, "MMU %s: external device address %08lx / "
+ "size %08x is not valid!\n", mmu->name, p, count);
return -EFAULT;
}
if (count > (1 << mmu->addrspace) - p)
void *vadr = omap_mmu_to_virt(mmu, p);
if (!exmap_valid(mmu, vadr, count)) {
- dev_err(&mmu->dev, "MMU: DSP address %08lx / size %08x "
- "is not valid!\n", p, count);
+ dev_err(&mmu->dev, "MMU %s: external device address %08lx "
+ "/ size %08x is not valid!\n", mmu->name, p, count);
return -EFAULT;
}
if (count > (1 << mmu->addrspace) - p)
int i = 0;
down_read(&mmu->exmap_sem);
- len = sprintf(buf, " dspadr size buf size uc\n");
+ len = sprintf(buf, " devadr size buf size uc\n");
/* 0x300000 0x123000 0xc0171000 0x100000 0*/
omap_mmu_for_each_tlb_entry(mmu, ent) {