mirror of
https://github.com/apache/nuttx.git
synced 2026-10-04 12:48:09 +00:00
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:
parent
d00ee139f9
commit
cdbe91aeb9
3 changed files with 9 additions and 29 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue