Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
system_mm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
15#ifndef ZEPHYR_INCLUDE_DRIVERS_SYSTEM_MM_H_
16#define ZEPHYR_INCLUDE_DRIVERS_SYSTEM_MM_H_
17
18#include <zephyr/types.h>
19
20#ifndef _ASMLANGUAGE
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
46#define SYS_MM_MEM_CACHE_NONE 2
47
49#define SYS_MM_MEM_CACHE_WT 1
50
52#define SYS_MM_MEM_CACHE_WB 0
53
55#define SYS_MM_MEM_CACHE_MASK (BIT(3) - 1)
56
70#define SYS_MM_MEM_PERM_RW BIT(3)
71
73#define SYS_MM_MEM_PERM_EXEC BIT(4)
74
76#define SYS_MM_MEM_PERM_USER BIT(5)
77
111
133int sys_mm_drv_map_region(void *virt, uintptr_t phys,
134 size_t size, uint32_t flags);
135
157int sys_mm_drv_map_array(void *virt, uintptr_t *phys,
158 size_t cnt, uint32_t flags);
159
181int sys_mm_drv_unmap_page(void *virt);
182
205int sys_mm_drv_unmap_region(void *virt, size_t size);
206
234int sys_mm_drv_remap_region(void *virt_old, size_t size, void *virt_new);
235
279int sys_mm_drv_move_region(void *virt_old, size_t size, void *virt_new,
280 uintptr_t phys_new);
281
314int sys_mm_drv_move_array(void *virt_old, size_t size, void *virt_new,
315 uintptr_t *phys_new, size_t phys_cnt);
316
350
372int sys_mm_drv_update_region_flags(void *virt, size_t size, uint32_t flags);
373
403int sys_mm_drv_page_phys_get(void *virt, uintptr_t *phys);
404
412 void *addr;
413 size_t size;
415};
416
417/* TODO is it safe to assume no valid region has size == 0? */
424#define SYS_MM_DRV_MEMORY_REGION_FOREACH(regions, iter) \
425 for (iter = regions; iter->size; iter++)
426
439
451
460#ifdef __cplusplus
461}
462#endif
463
464#endif /* _ASMLANGUAGE */
465
466#endif /* ZEPHYR_INCLUDE_DRIVERS_SYSTEM_MM_H_ */
int sys_mm_drv_map_region(void *virt, uintptr_t phys, size_t size, uint32_t flags)
Map a region of physical memory into the virtual address space.
int sys_mm_drv_update_page_flags(void *virt, uint32_t flags)
Update memory page flags.
int sys_mm_drv_move_region(void *virt_old, size_t size, void *virt_new, uintptr_t phys_new)
Physically move memory, with copy.
int sys_mm_drv_update_region_flags(void *virt, size_t size, uint32_t flags)
Update memory region flags.
int sys_mm_drv_map_page(void *virt, uintptr_t phys, uint32_t flags)
Map one physical page into the virtual address space.
int sys_mm_drv_page_phys_get(void *virt, uintptr_t *phys)
Get the mapped physical memory address from virtual address.
int sys_mm_drv_move_array(void *virt_old, size_t size, void *virt_new, uintptr_t *phys_new, size_t phys_cnt)
Physically move memory, with copy.
int sys_mm_drv_map_array(void *virt, uintptr_t *phys, size_t cnt, uint32_t flags)
Map an array of physical memory into the virtual address space.
int sys_mm_drv_unmap_page(void *virt)
Remove mapping for one page of the provided virtual address.
void sys_mm_drv_query_memory_regions_free(const struct sys_mm_drv_region *regions)
Free the memory array returned by sys_mm_drv_query_memory_regions.
int sys_mm_drv_unmap_region(void *virt, size_t size)
Remove mappings for a provided virtual address range.
int sys_mm_drv_remap_region(void *virt_old, size_t size, void *virt_new)
Remap virtual pages into new address.
const struct sys_mm_drv_region * sys_mm_drv_query_memory_regions(void)
Query available memory regions.
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105
Represents an available memory region.
Definition: system_mm.h:411
size_t size
Size of the memory region.
Definition: system_mm.h:413
uint32_t attr
Driver defined attributes of the memory region.
Definition: system_mm.h:414
void * addr
Address of the memory region.
Definition: system_mm.h:412