Skip to content

Commit

Permalink
core: mmu: add get_io_base helper function
Browse files Browse the repository at this point in the history
Add get_io_base helper function.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
  • Loading branch information
MrVan committed May 31, 2017
1 parent f890178 commit 932f8c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/arch/arm/include/mm/core_memprot.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,9 @@ paddr_t virt_to_phys(void *va);
*/
vaddr_t get_base(paddr_t base, enum teecore_memtypes type);

/*
* Return runtime usable io address
*/
vaddr_t get_io_base(paddr_t base);

#endif /* CORE_MEMPROT_H */
8 changes: 8 additions & 0 deletions core/arch/arm/mm/core_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,14 @@ bool cpu_mmu_enabled(void)
return sctlr & SCTLR_M ? true : false;
}

vaddr_t get_io_base(paddr_t base)
{
if (cpu_mmu_enabled())
return (vaddr_t)phys_to_virt_io(base);

return (vaddr_t)base;
}

vaddr_t get_base(paddr_t base, enum teecore_memtypes type)
{
if (cpu_mmu_enabled())
Expand Down

0 comments on commit 932f8c0

Please sign in to comment.