armv7a: rename and implement va2pa & pa2va

Notice: the up_addrenv_pa_to_va is not correct, it will be complex if we
search all address to lookup all virtual address according to physical
address.
Use up_addrenv_x method as common interface across va & pa

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2025-02-28 12:58:11 +08:00 • committed by Xiang Xiao
parent d00ee139f9
commit cdbe91aeb9
3 changed files with 9 additions and 29 deletions

View file

@ -46,7 +46,7 @@
****************************************************************************/
/****************************************************************************
* Name: arm_physpgaddr
* Name: up_addrenv_va_to_pa
*
* Description:
* Check if the virtual address lies in the user data area and, if so
@ -54,8 +54,9 @@
*
****************************************************************************/
uintptr_t arm_physpgaddr(uintptr_t vaddr)
uintptr_t up_addrenv_va_to_pa(void *va)
{
uintptr_t vaddr = (uintptr_t)va;
uint32_t *l2table;
uintptr_t paddr;
uint32_t l1entry;
@ -113,7 +114,7 @@ uintptr_t arm_physpgaddr(uintptr_t vaddr)
/* No mapping available */
return 0;
return vaddr;
}
#endif /* CONFIG_MM_PGALLOC */

View file

@ -35,7 +35,7 @@
****************************************************************************/
/****************************************************************************
* Name: arm_virtpgaddr
* Name: up_addrenv_pa_to_va
*
* Description:
* Check if the physical address lies in the page pool and, if so
@ -43,7 +43,7 @@
*
****************************************************************************/
uintptr_t arm_virtpgaddr(uintptr_t paddr)
void *up_addrenv_pa_to_va(uintptr_t paddr)
{
/* REVISIT: Not implemented correctly. The reverse lookup from physical
* to virtual. This will return a kernel accessible virtual address, but
@ -54,10 +54,11 @@ uintptr_t arm_virtpgaddr(uintptr_t paddr)
if (paddr >= CONFIG_ARCH_PGPOOL_PBASE && paddr < CONFIG_ARCH_PGPOOL_PEND)
{
return paddr - CONFIG_ARCH_PGPOOL_PBASE + CONFIG_ARCH_PGPOOL_VBASE;
return (void *)(paddr - CONFIG_ARCH_PGPOOL_PBASE +
CONFIG_ARCH_PGPOOL_VBASE);
}
return 0;
return (void *)paddr;
}
#endif /* CONFIG_MM_PGALLOC */

View file

@ -179,27 +179,5 @@ static inline uintptr_t get_l2_entry(uint32_t *l2table, uintptr_t vaddr)
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Name: arm_physpgaddr
*
* Description:
* Check if the virtual address lies in the user data area and, if so
* get the mapping to the physical address in the page pool.
*
****************************************************************************/
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.
*
****************************************************************************/
uintptr_t arm_virtpgaddr(uintptr_t paddr);
#endif /* CONFIG_MM_PGALLOC */
#endif /* __ARCH_ARM_SRC_ARMV7_A_PGALLOC_H */