kernel: mm: rename Z_BOOT_* to K_MEM_BOOT_*

Rename Z_BOOT_VIRT_TO_PHYS() and Z_BOOT_PHYS_TO_VIRT() to
K_MEM_BOOT_VIRT_TO_PHYS() and K_MEM_BOOT_PHYS_TO_VIRT()
respectively. This is part of a series to move memory management
functions away from the Z_ namespace and into its own namespace.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-06-07 09:16:35 -07:00 committed by Anas Nashif
parent 2d2bbc05d6
commit def364ab08
2 changed files with 27 additions and 8 deletions

View file

@ -43,15 +43,34 @@
#define Z_VM_OFFSET ((CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_OFFSET) - \
(CONFIG_SRAM_BASE_ADDRESS + CONFIG_SRAM_OFFSET))
/* Only applies to boot RAM mappings within the Zephyr image that have never
* been remapped or paged out. Never use this unless you know exactly what you
* are doing.
/**
* @brief Get physical address from virtual address for boot RAM mappings.
*
* @note Only applies to boot RAM mappings within the Zephyr image that have never
* been remapped or paged out. Never use this unless you know exactly what you
* are doing.
*
* @param virt Virtual address.
*
* @return Physical address.
*/
#define Z_BOOT_VIRT_TO_PHYS(virt) ((uintptr_t)(((uint8_t *)(virt)) - Z_VM_OFFSET))
#define Z_BOOT_PHYS_TO_VIRT(phys) ((uint8_t *)(((uintptr_t)(phys)) + Z_VM_OFFSET))
#define K_MEM_BOOT_VIRT_TO_PHYS(virt) ((uintptr_t)(((uint8_t *)(virt)) - Z_VM_OFFSET))
/**
* @brief Get virtual address from physical address for boot RAM mappings.
*
* @note Only applies to boot RAM mappings within the Zephyr image that have never
* been remapped or paged out. Never use this unless you know exactly what you
* are doing.
*
* @param phys Physical address.
*
* @return Virtual address.
*/
#define K_MEM_BOOT_PHYS_TO_VIRT(phys) ((uint8_t *)(((uintptr_t)(phys)) + Z_VM_OFFSET))
#ifdef CONFIG_ARCH_MAPS_ALL_RAM
#define Z_FREE_VM_START Z_BOOT_PHYS_TO_VIRT(Z_PHYS_RAM_END)
#define Z_FREE_VM_START K_MEM_BOOT_PHYS_TO_VIRT(Z_PHYS_RAM_END)
#else
#define Z_FREE_VM_START Z_KERNEL_VIRT_END
#endif /* CONFIG_ARCH_MAPS_ALL_RAM */

View file

@ -936,7 +936,7 @@ static void mark_linker_section_pinned(void *start_addr, void *end_addr,
VIRT_FOREACH(UINT_TO_POINTER(pinned_start), pinned_size, addr)
{
pf = z_phys_to_page_frame(Z_BOOT_VIRT_TO_PHYS(addr));
pf = z_phys_to_page_frame(K_MEM_BOOT_VIRT_TO_PHYS(addr));
frame_mapped_set(pf, addr);
if (pin) {
@ -972,7 +972,7 @@ void z_mem_manage_init(void)
*/
VIRT_FOREACH(Z_KERNEL_VIRT_START, Z_KERNEL_VIRT_SIZE, addr)
{
pf = z_phys_to_page_frame(Z_BOOT_VIRT_TO_PHYS(addr));
pf = z_phys_to_page_frame(K_MEM_BOOT_VIRT_TO_PHYS(addr));
frame_mapped_set(pf, addr);
/* TODO: for now we pin the whole Zephyr image. Demand paging