diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 939ab357dff..82ba23bc522 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -102,6 +102,9 @@ endif ifeq ($(CONFIG_MM_PGALLOC),y) CMN_CSRCS += arm_physpgaddr.c +ifeq ($(CONFIG_ARCH_PGPOOL_MAPPING),y) +CMN_CSRCS += arm_virtpgaddr.c +endif endif ifeq ($(CONFIG_ELF),y) diff --git a/arch/arm/src/armv7-a/pgalloc.h b/arch/arm/src/armv7-a/pgalloc.h index ee39f100f58..3991b92fe95 100644 --- a/arch/arm/src/armv7-a/pgalloc.h +++ b/arch/arm/src/armv7-a/pgalloc.h @@ -43,6 +43,8 @@ #include #include +#include +#include #include @@ -154,5 +156,18 @@ static inline bool arm_uservaddr(uintptr_t vaddr) uintptr_t arm_physpgaddr(uintptr_t vaddr); +/**************************************************************************** + * Name: arm_virtpgaddr + * + * Description: + * Check if the physical address lies in the page pool and, if so + * get the mapping to the virtual address in the user data area. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_PGPOOL_MAPPING +uintptr_t arm_virtpgaddr(uintptr_t paddr); +#endif + #endif /* CONFIG_MM_PGALLOC */ #endif /* __ARCH_ARM_SRC_ARMV7_A_PGALLOC_H */ diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index 6feae083d26..ba8012837ee 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -104,6 +104,9 @@ endif ifeq ($(CONFIG_MM_PGALLOC),y) CMN_CSRCS += arm_physpgaddr.c +ifeq ($(CONFIG_ARCH_PGPOOL_MAPPING),y) +CMN_CSRCS += arm_virtpgaddr.c +endif endif ifeq ($(CONFIG_ELF),y) diff --git a/arch/arm/src/sama5/sam_pgalloc.c b/arch/arm/src/sama5/sam_pgalloc.c index a90582cb36d..5fbaac8a959 100644 --- a/arch/arm/src/sama5/sam_pgalloc.c +++ b/arch/arm/src/sama5/sam_pgalloc.c @@ -124,6 +124,7 @@ void up_allocate_pgheap(FAR void **heap_start, size_t *heap_size) * ****************************************************************************/ +#ifndef CONFIG_ARCH_PGPOOL_MAPPING uintptr_t sam_virtpgaddr(uintptr_t paddr) { uintptr_t poolstart; @@ -146,5 +147,6 @@ uintptr_t sam_virtpgaddr(uintptr_t paddr) return 0; } +#endif /* !CONFIG_ARCH_PGPOOL_MAPPING */ #endif /* CONFIG_MM_PGALLOC */ diff --git a/arch/arm/src/sama5/sam_pgalloc.h b/arch/arm/src/sama5/sam_pgalloc.h index b79ba1a854b..75f4f90f1b3 100644 --- a/arch/arm/src/sama5/sam_pgalloc.h +++ b/arch/arm/src/sama5/sam_pgalloc.h @@ -88,7 +88,11 @@ extern "C" * ****************************************************************************/ +#ifdef CONFIG_ARCH_PGPOOL_MAPPING +# define sam_virtpgaddr(vaddr) arm_virtpgaddr(vaddr) +#else uintptr_t sam_virtpgaddr(uintptr_t paddr); +#endif #undef EXTERN #ifdef __cplusplus